[Commits] d6f3a00: MDEV-14185 CREATE TEMPORARY TABLE AS SELECT causes error 1290 with read_only and InnoDB.

Alexey Botchkov holyfoot at askmonty.org
Sat Apr 7 20:54:59 EEST 2018


revision-id: d6f3a0064be73cd134fd474e5ddc63646e09938a (mariadb-5.5.59-55-gd6f3a00)
parent(s): 6beb08c7b67ed7610e95c0350f9f93005db1e055
committer: Alexey Botchkov
timestamp: 2018-04-07 21:51:15 +0400
message:

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.

---
 mysql-test/r/read_only_innodb.result | 8 ++++++++
 mysql-test/t/read_only_innodb.test   | 9 +++++++++
 sql/handler.cc                       | 3 ++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/mysql-test/r/read_only_innodb.result b/mysql-test/r/read_only_innodb.result
index 1e04139..2af72d3 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 de237fe..f89cf74 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 dc40e34..d8a9ac6 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);
 }


More information about the commits mailing list