Commit c913cd2b authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-17885 TRUNCATE on temporary table causes ER_GET_ERRNO

ha_innobase::truncate(): Because CREATE TEMPORARY TABLE
allows invalid table options when innodb_file_per_table=1,
do allow them also in TRUNCATE for temporary tables.
parent 91173f98
...@@ -30,3 +30,12 @@ SELECT * FROM t1; ...@@ -30,3 +30,12 @@ SELECT * FROM t1;
a a
1 1
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-17885 TRUNCATE on temporary table causes ER_GET_ERRNO
#
CREATE TEMPORARY TABLE t1 (a INT) ENCRYPTED=NO ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
TRUNCATE t1;
SELECT * FROM t1;
a
DROP TEMPORARY TABLE t1;
...@@ -41,3 +41,12 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB; ...@@ -41,3 +41,12 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB;
--move_file $MYSQLD_DATADIR/test/hidden.frm $MYSQLD_DATADIR/test/t1.frm --move_file $MYSQLD_DATADIR/test/hidden.frm $MYSQLD_DATADIR/test/t1.frm
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-17885 TRUNCATE on temporary table causes ER_GET_ERRNO
--echo #
CREATE TEMPORARY TABLE t1 (a INT) ENCRYPTED=NO ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
TRUNCATE t1;
SELECT * FROM t1;
DROP TEMPORARY TABLE t1;
...@@ -13531,7 +13531,8 @@ int ha_innobase::truncate() ...@@ -13531,7 +13531,8 @@ int ha_innobase::truncate()
row_mysql_unlock_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
} else { } else {
err = create(name, table, &info, err = create(name, table, &info,
dict_table_is_file_per_table(ib_table), trx); ib_table->is_temporary()
|| dict_table_is_file_per_table(ib_table), trx);
} }
trx_free_for_mysql(trx); trx_free_for_mysql(trx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment