diff options
author | Vesa Pentti <vesa.pentti@mariadb.net> | 2018-01-11 15:18:29 +0000 |
---|---|---|
committer | Vesa Pentti <vesa.pentti@mariadb.net> | 2018-01-12 10:15:50 +0000 |
commit | d4366c4a2c9b41901b11ca180d3ddbf79e992490 (patch) | |
tree | 24d72f6b7b3c8fc9cf5c547af5320fc41dfc87c6 | |
parent | 84c9c8b2e9d68d7014e8b3e17e0d6df8efb3215b (diff) | |
download | mariadb-git-bb-5.5-pentve.tar.gz |
MDEV-14185 -- CREATE TEMPORARY TABLE AS SELECT causes error 1290 with read_only and InnoDBbb-5.5-pentve
* Did affect only transactional engines like InnoDB
* Note: During table creation handler's 'table_share' is NULL
* Now the transaction isn't marked rw for a temporary table when it's created
-rw-r--r-- | mysql-test/t/create_select_temporary_table.test | 23 | ||||
-rw-r--r-- | sql/handler.cc | 5 |
2 files changed, 27 insertions, 1 deletions
diff --git a/mysql-test/t/create_select_temporary_table.test b/mysql-test/t/create_select_temporary_table.test new file mode 100644 index 00000000000..d5dea48f43c --- /dev/null +++ b/mysql-test/t/create_select_temporary_table.test @@ -0,0 +1,23 @@ +--source include/have_innodb.inc + +SET GLOBAL read_only = on; +CREATE DATABASE mydb; +use mydb; +CREATE TABLE mytable (id INTEGER) ENGINE=InnoDB; +INSERT INTO mytable (id) VALUES (1); + +CREATE USER 'nosuper'@'localhost'; +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE TEMPORARY TABLES, LOCK TABLES ON mydb.* TO 'nosuper'@'localhost'; + +--connect (con1,localhost,nosuper,,mydb) + +CREATE TEMPORARY TABLE t1 ENGINE=InnoDB AS SELECT id FROM mytable; + +# Cleanup + +--disconnect con1 +--connection default +DROP DATABASE mydb; +DROP USER nosuper@localhost; +SET GLOBAL read_only = DEFAULT; + diff --git a/sql/handler.cc b/sql/handler.cc index dc40e34bc3d..84d73458753 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3770,7 +3770,10 @@ 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); } |