3
DROP DATABASE IF EXISTS `drop-temp+table-test`;
6
connect (con1,localhost,root,,);
7
connect (con2,localhost,root,,);
10
CREATE DATABASE `drop-temp+table-test`;
11
USE `drop-temp+table-test`;
12
CREATE TEMPORARY TABLE shortn1 (a INT);
13
CREATE TEMPORARY TABLE `table:name` (a INT);
14
CREATE TEMPORARY TABLE shortn2 (a INT);
16
##############################################################################
17
# BUG#46572 DROP TEMPORARY table IF EXISTS does not have a consistent behavior
20
# In RBR, 'DROP TEMPORARY TABLE ...' statement should never be binlogged no
21
# matter if the tables exist or not. In contrast, both in SBR and MBR, the
22
# statement should be always binlogged no matter if the tables exist or not.
23
##############################################################################
24
CREATE TEMPORARY TABLE tmp(c1 int);
25
CREATE TEMPORARY TABLE tmp1(c1 int);
26
CREATE TEMPORARY TABLE tmp2(c1 int);
27
CREATE TEMPORARY TABLE tmp3(c1 int);
28
CREATE TABLE t(c1 int);
30
DROP TEMPORARY TABLE IF EXISTS tmp;
33
# Before fixing BUG#46572, 'DROP TEMPORARY TABLE IF EXISTS...' statement was
34
# binlogged when the table did not exist in RBR.
35
DROP TEMPORARY TABLE IF EXISTS tmp;
37
# In RBR, 'DROP TEMPORARY TABLE ...' statement is never binlogged no matter if
38
# the tables exist or not.
39
DROP TEMPORARY TABLE IF EXISTS tmp, tmp1;
40
DROP TEMPORARY TABLE tmp3;
42
#In RBR, tmp2 will NOT be binlogged, because it is a temporary table.
43
DROP TABLE IF EXISTS tmp2, t;
45
#In RBR, tmp2 will be binlogged, because it does not exist and master do not know
46
# whether it is a temporary table or not.
47
DROP TABLE IF EXISTS tmp2, t;
50
SELECT GET_LOCK("a",10);
53
# BUG48216 Replication fails on all slaves after upgrade to 5.0.86 on master
55
# When the session is closed, any temporary tables of the session are dropped
56
# and are binlogged. But it will be binlogged with a wrong database name when
57
# the length of the database name('drop-temp-table-test') is greater than the
58
# current database name('test').
64
# We want to SHOW BINLOG EVENTS, to know what was logged. But there is no
65
# guarantee that logging of the terminated con1 has been done yet.
66
# To be sure that logging has been done, we use a user lock.
67
SELECT GET_LOCK("a",10);
68
let $VERSION=`SELECT VERSION()`;
69
source include/show_binlog_events.inc;
70
DROP DATABASE `drop-temp+table-test`;