Commit 56a6e71f authored by Sergey Petrunya's avatar Sergey Petrunya

Fix merge.test failure

- Problem: mysql_admin_table() calls open_temporary_tables(). This 
  causes assertion failure, because mysql_execute_command() has 
  already called open_temporary_tables()
- Solution: call close_thread_tables() at the start of 
  mysql_admin_table(), like mysql-5.6 does 
parent c9ad3260
......@@ -2262,7 +2262,7 @@ CREATE TABLE m1(a int)engine=merge union=(t1,t2,t3,t4,t5,t6,t7);
SELECT 1 FROM m1;
1
HANDLER m1 OPEN;
ERROR HY000: Table storage engine for 'm1' doesn't have this option
ERROR HY000: Storage engine MRG_MyISAM of the table `test`.`m1` doesn't have this option
DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7;
SELECT 1 FROM m1;
ERROR 42S02: Table 'test.m1' doesn't exist
......@@ -3421,7 +3421,7 @@ CREATE TABLE t2 (c1 int);
CREATE TABLE t3 (c1 int) ENGINE = MERGE UNION (t1,t2);
START TRANSACTION;
HANDLER t3 OPEN;
ERROR HY000: Table storage engine for 't3' doesn't have this option
ERROR HY000: Storage engine MRG_MyISAM of the table `test`.`t3` doesn't have this option
DROP TABLE t1, t2, t3;
# Connection default.
# Disconnecting con1, all mdl_tickets must have been released.
......
......@@ -352,6 +352,14 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
mysql_ha_rm_tables(thd, tables);
/*
Close all temporary tables which were pre-open to simplify
privilege checking. Clear all references to closed tables.
*/
close_thread_tables(thd);
for (table= tables; table; table= table->next_local)
table->table= NULL;
for (table= tables; table; table= table->next_local)
{
char table_name[SAFE_NAME_LEN*2+2];
......
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