diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-12-12 16:31:34 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-12-12 16:31:34 +0200 |
commit | c913cd2b669f906f17c87b4c0864ae95b3911e03 (patch) | |
tree | 923f719639c8309a88f1e4f13e438efae77f0f72 | |
parent | 91173f986373e4f5f134a2351a80d8763e5157e8 (diff) | |
download | mariadb-git-c913cd2b669f906f17c87b4c0864ae95b3911e03.tar.gz |
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.
-rw-r--r-- | mysql-test/suite/innodb/r/truncate.result | 9 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/truncate.test | 9 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 3 |
3 files changed, 20 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb/r/truncate.result b/mysql-test/suite/innodb/r/truncate.result index d3ea2716464..5e9fd60d4fe 100644 --- a/mysql-test/suite/innodb/r/truncate.result +++ b/mysql-test/suite/innodb/r/truncate.result @@ -30,3 +30,12 @@ SELECT * FROM t1; a 1 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; diff --git a/mysql-test/suite/innodb/t/truncate.test b/mysql-test/suite/innodb/t/truncate.test index 6c573cf42d4..cd1d827e157 100644 --- a/mysql-test/suite/innodb/t/truncate.test +++ b/mysql-test/suite/innodb/t/truncate.test @@ -41,3 +41,12 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB; --move_file $MYSQLD_DATADIR/test/hidden.frm $MYSQLD_DATADIR/test/t1.frm SELECT * FROM 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; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 717b67290dc..b941ce8b825 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -13531,7 +13531,8 @@ int ha_innobase::truncate() row_mysql_unlock_data_dictionary(trx); } else { 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); |