summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl/r/rpl_create_if_not_exists.result
blob: d12f3ff1360488460779c2b45d4157b303f79de9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
include/master-slave.inc
[connection master]
DROP DATABASE IF EXISTS mysqltest;
CREATE DATABASE IF NOT EXISTS mysqltest;
USE mysqltest;
CREATE TABLE IF NOT EXISTS t(c1 int);
CREATE TABLE IF NOT EXISTS t1 LIKE t;
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t;
CREATE EVENT IF NOT EXISTS e 
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR 
DO SELECT now();
DROP DATABASE mysqltest;
CREATE DATABASE IF NOT EXISTS mysqltest;
USE mysqltest;
CREATE TABLE IF NOT EXISTS t(c1 int);
CREATE TABLE IF NOT EXISTS t1 LIKE t;
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t;
CREATE EVENT IF NOT EXISTS e 
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR 
DO SELECT now();
SHOW TABLES in mysqltest;
Tables_in_mysqltest
t
t1
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;
# WL#5370
# The behavior of statement 'CREATE TABLE SELECT IF NOT EXISTS' is changed.
# After the worklog, it will insert nothing and the statement will not be
# binlogged if the table already exists.
# After the worklog, some bugs will disappear automotically.
include/rpl_reset.inc

# Case 1: BUG#47132
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*");
CREATE TABLE t1 (id int);
CREATE TABLE t2 (id int);
INSERT INTO t1 VALUES (1), (1);
INSERT INTO t2 VALUES (2), (2);
CREATE VIEW v1 AS SELECT id FROM t2;
CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id FROM t1;
Warnings:
Note	1050	Table 'v1' already exists
show binlog events from <binlog_start>;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
SHOW CREATE TABLE v1;
View	Create View	character_set_client	collation_connection
v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t2`.`id` AS `id` from `t2`	latin1	latin1_swedish_ci
SELECT * FROM t2;
id
2
2
SELECT * FROM v1;
id
2
2
DROP VIEW v1;
CREATE TEMPORARY TABLE tt1 AS SELECT id FROM t2;
CREATE TEMPORARY TABLE IF NOT EXISTS tt1(a int, b int) SELECT id, id FROM t1;
Warnings:
Note	1050	Table 'tt1' already exists
show binlog events from <binlog_start>;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
SELECT * FROM t2;
id
2
2
SELECT * FROM tt1;
id
2
2
DROP TEMPORARY TABLE tt1;

# Case 1: BUG#47132
# RBR breaks on CREATE TABLE IF EXISTS <existing VIEW> AS SELECT
CREATE VIEW v1 AS SELECT 1 as a;
CREATE TABLE IF NOT EXISTS v1 SELECT 2 as a;
Warnings:
Note	1050	Table 'v1' already exists
show binlog events from <binlog_start>;
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
DROP VIEW v1;
DROP TABLE t1, t2;
include/rpl_end.inc