Skip to content
Permalink
Browse files

MDEV-14185 CREATE TEMPORARY TABLE AS SELECT causes error 1290 with re…

…ad_only and InnoDB.

handler::ha_create_handler_files shouldn't call the
mark_trx_read_write() for the temporary table.
  • Loading branch information...
Alexey Botchkov
Alexey Botchkov committed Apr 7, 2018
1 parent 6beb08c commit d6f3a0064be73cd134fd474e5ddc63646e09938a
Showing with 19 additions and 1 deletion.
  1. +8 −0 mysql-test/r/read_only_innodb.result
  2. +9 −0 mysql-test/t/read_only_innodb.test
  3. +2 −1 sql/handler.cc
@@ -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);
}

0 comments on commit d6f3a00

Please sign in to comment.
You can’t perform that action at this time.