From 377d710296c3b0c85ea4cdc018d1d8e08bfa022a Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 16 Jan 2010 15:44:24 +0800 Subject: BUG#47418 RBR fails, failure with mixup of base/temporary/view 'CREATE TABLE IF NOT EXISTS ... SELECT' statement were causing 'CREATE TEMPORARY TABLE ...' to be written to the binary log in row-based mode (a.k.a. RBR), when there was a temporary table with the same name. Because the 'CREATE TABLE ... SELECT' statement was executed as 'INSERT ... SELECT' into the temporary table. Since in RBR mode no other statements related to temporary tables are written into binary log, this sometimes broke replication. This patch changes behavior of 'CREATE TABLE [IF NOT EXISTS] ... SELECT ...'. it ignores existence of temporary table with the same name as table being created and is interpreted as attempt to create/insert into base table. This makes behavior of 'CREATE TABLE [IF NOT EXISTS] ... SELECT' consistent with how ordinary 'CREATE TABLE' and 'CREATE TABLE ... LIKE' behave. --- mysql-test/t/ps_ddl.test | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'mysql-test/t/ps_ddl.test') diff --git a/mysql-test/t/ps_ddl.test b/mysql-test/t/ps_ddl.test index fee235cd36c..1543c757908 100644 --- a/mysql-test/t/ps_ddl.test +++ b/mysql-test/t/ps_ddl.test @@ -1445,18 +1445,19 @@ call p_verify_reprepare_count(0); drop table t2; # Temporary table with name of table to be created exists create temporary table t2 (a int); ---error ER_TABLE_EXISTS_ERROR +# Temporary table and base table are not in the same name space. execute stmt; call p_verify_reprepare_count(1); --error ER_TABLE_EXISTS_ERROR execute stmt; -call p_verify_reprepare_count(0); +call p_verify_reprepare_count(1); drop temporary table t2; +--error ER_TABLE_EXISTS_ERROR execute stmt; -call p_verify_reprepare_count(1); +call p_verify_reprepare_count(0); drop table t2; execute stmt; -call p_verify_reprepare_count(0); +call p_verify_reprepare_count(1); drop table t2; # View with name of table to be created exists # Attention: -- cgit v1.2.1