mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -31,3 +31,37 @@ SHOW EVENTS in mysqltest;
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
mysqltest e root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP DATABASE IF EXISTS mysqltest;
|
||||
-------------BUG#47418-------------
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
CREATE TABLE t3(c1 INTEGER);
|
||||
INSERT INTO t3 VALUES(33);
|
||||
CREATE TEMPORARY TABLE t1(c1 INTEGER);
|
||||
CREATE TEMPORARY TABLE t2(c1 INTEGER);
|
||||
INSERT INTO t1 VALUES(1);
|
||||
INSERT INTO t2 VALUES(1);
|
||||
CREATE TABLE IF NOT EXISTS t1(c1 INTEGER) SELECT c1 FROM t3;
|
||||
CREATE TABLE t2(c1 INTEGER) SELECT c1 FROM t3;
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
SELECT * FROM t2;
|
||||
c1
|
||||
1
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
33
|
||||
SELECT * FROM t2;
|
||||
c1
|
||||
33
|
||||
DROP TEMPORARY TABLE t1;
|
||||
DROP TEMPORARY TABLE t2;
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
33
|
||||
SELECT * FROM t2;
|
||||
c1
|
||||
33
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
|
Reference in New Issue
Block a user