From f38d8c17010642b038cb886bb8a40389c91f996d Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 17 May 2018 22:03:53 +0530 Subject: MDEV-16201 CREATE TABLE creates extra transaction InnoDB does not allow FOREIGN KEY constraints to exist for TEMPORARY TABLE. InnoDB introduced a dedicated tablespace for temporary tables, and actually stopped creating persistent metadata and data for temporary tables. row_table_add_foreign_constraints(): Do not create a persistent transaction. dict_create_foreign_constraints_low(): Add the persistent transaction to the update the foreign key relation in dictionary. dict_create_foreign_constraints_low(): Remove a duplicated check for partitioned tables. --- mysql-test/suite/innodb/r/temporary_table.result | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mysql-test/suite/innodb/r/temporary_table.result') diff --git a/mysql-test/suite/innodb/r/temporary_table.result b/mysql-test/suite/innodb/r/temporary_table.result index 64eb3270934..533d32089c3 100644 --- a/mysql-test/suite/innodb/r/temporary_table.result +++ b/mysql-test/suite/innodb/r/temporary_table.result @@ -650,3 +650,11 @@ SELECT * FROM t1; f1 0 DROP TABLE t1; +# +# MDEV-15874 CREATE TABLE creates extra transaction +# +call mtr.add_suppression("Warning 150 Create table `mysqld.1`.`t1` with foreign key constraint failed. Temporary tables can't have foreign key constraints.*"); +SET FOREIGN_KEY_CHECKS = 0; +CREATE TEMPORARY TABLE t1(f1 INT NOT NULL, +FOREIGN KEY(f1) REFERENCES t0(f1))ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") -- cgit v1.2.1