diff options
author | unknown <Li-Bing.Song@sun.com> | 2010-01-16 15:44:24 +0800 |
---|---|---|
committer | unknown <Li-Bing.Song@sun.com> | 2010-01-16 15:44:24 +0800 |
commit | 377d710296c3b0c85ea4cdc018d1d8e08bfa022a (patch) | |
tree | 5cb87884cc819c950b796602fd62601a7c339e24 /sql/sql_prepare.cc | |
parent | 7a7147c5b4cca1bfd1bfbecd4883d3968526b162 (diff) | |
download | mariadb-git-377d710296c3b0c85ea4cdc018d1d8e08bfa022a.tar.gz |
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.
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index e2a24f7da1e..5979f2ca17e 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1596,6 +1596,8 @@ static bool mysql_test_create_table(Prepared_statement *stmt) { lex->link_first_table_back(create_table, link_to_local); create_table->create= TRUE; + /* Base table and temporary table are not in the same name space. */ + create_table->skip_temporary= true; } if (open_normal_and_derived_tables(stmt->thd, lex->query_tables, 0)) |