Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-17983

CREATE TEMPORARY TABLE is inconsistent when refusing InnoDB table options

    XMLWordPrintable

    Details

      Description

      Starting with MariaDB Server 10.2.2, CREATE TEMPORARY TABLE in InnoDB actually creates temporary tables instead of persistent, redo-logged tables like it used to do. These tables are always created in a shared temporary tablespace.

      However, CREATE TEMPORARY TABLE is not consistent when checking whether the table attributes are valid. The setting innodb_file_per_table should have no effect on the creation of temporary tables, but unfortunately it does have an effect:

      --source include/have_innodb.inc
      SET @save_per_table = @@GLOBAL.innodb_file_per_table;
      SET GLOBAL innodb_file_per_table=1;
      CREATE TEMPORARY TABLE t1 (a INT) ENGINE=InnoDB ENCRYPTED=NO;
      DROP TEMPORARY TABLE t1;
      SET GLOBAL innodb_file_per_table=0;
      CREATE TEMPORARY TABLE t1 (a INT) ENGINE=InnoDB ENCRYPTED=NO;
      SET GLOBAL innodb_file_per_table=@save_per_table;
      

      The first CREATE TEMPORARY TABLE succeeds, but the second one will fail:

      10.2 c913cd2b669f906f17c87b4c0864ae95b3911e03

      mysqltest: At line 7: query 'CREATE TEMPORARY TABLE t1 (a INT) ENGINE=InnoDB ENCRYPTED=NO' failed: 1005: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
      

      Sergei Golubchik suggested that we should issue errors if IGNORE_BAD_TABLE_OPTIONS sql_mode is not set, and warnings otherwise. To check for that option, it looks like thd_is_strict_mode() should be replaced with something that returns the sql_mode flags, or a new accessor function should be added.

      When fixing this, please consider also the TRUNCATE code path, which was last fixed in MDEV-17885.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kevg Eugene Kosov
              Reporter:
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: