Commit d6f3a006 authored by Alexey Botchkov's avatar Alexey Botchkov

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.
parent 6beb08c7
......@@ -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;
......
......@@ -243,6 +243,15 @@ UPDATE temp1,temp2 SET temp1.a = 5, temp2.a = 10;
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
......
......@@ -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);
}
......
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