diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2018-04-07 21:51:15 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2018-04-07 21:51:15 +0400 |
commit | d6f3a0064be73cd134fd474e5ddc63646e09938a (patch) | |
tree | 8a2ce18bacc65a1df6917639ce67d4ee3f0f171f | |
parent | 6beb08c7b67ed7610e95c0350f9f93005db1e055 (diff) | |
download | mariadb-git-d6f3a0064be73cd134fd474e5ddc63646e09938a.tar.gz |
MDEV-14185 CREATE TEMPORARY TABLE AS SELECT causes error 1290 with read_only and InnoDB.
handler::ha_create_handler_files shouldn't call the
mark_trx_read_write() for the temporary table.
-rw-r--r-- | mysql-test/r/read_only_innodb.result | 8 | ||||
-rw-r--r-- | mysql-test/t/read_only_innodb.test | 9 | ||||
-rw-r--r-- | sql/handler.cc | 3 |
3 files changed, 19 insertions, 1 deletions
diff --git a/mysql-test/r/read_only_innodb.result b/mysql-test/r/read_only_innodb.result index 1e041395d3c..2af72d30851 100644 --- a/mysql-test/r/read_only_innodb.result +++ b/mysql-test/r/read_only_innodb.result @@ -221,6 +221,14 @@ a a 5 10 DROP TABLE temp1, temp2; +# MDEV-14185 CREATE TEMPORARY TABLE AS SELECT causes error 1290 with read_only and InnoDB. + +CREATE TEMPORARY TABLE temp1 ENGINE=INNODB AS SELECT a FROM t1; +SELECT * FROM temp1; +a +1 +DROP TABLE temp1; + # Disconnect and cleanup SET GLOBAL READ_ONLY = OFF; diff --git a/mysql-test/t/read_only_innodb.test b/mysql-test/t/read_only_innodb.test index de237fecbb6..f89cf745973 100644 --- a/mysql-test/t/read_only_innodb.test +++ b/mysql-test/t/read_only_innodb.test @@ -244,6 +244,15 @@ SELECT * FROM temp1, temp2; DROP TABLE temp1, temp2; --echo +--echo # MDEV-14185 CREATE TEMPORARY TABLE AS SELECT causes error 1290 with read_only and InnoDB. +--echo + +CREATE TEMPORARY TABLE temp1 ENGINE=INNODB AS SELECT a FROM t1; +SELECT * FROM temp1; +DROP TABLE temp1; + + +--echo --echo # Disconnect and cleanup --echo disconnect con1; diff --git a/sql/handler.cc b/sql/handler.cc index dc40e34bc3d..d8a9ac6b05a 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3770,7 +3770,8 @@ int handler::ha_create_handler_files(const char *name, const char *old_name, int action_flag, HA_CREATE_INFO *info) { - mark_trx_read_write(); + if (!info || !(info->options & HA_LEX_CREATE_TMP_TABLE)) + mark_trx_read_write(); return create_handler_files(name, old_name, action_flag, info); } |