| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
DROP DATABASE IF EXISTS mysqltest; |
| 4 |
CREATE DATABASE IF NOT EXISTS mysqltest; |
| 5 |
USE mysqltest; |
| 6 |
CREATE TABLE IF NOT EXISTS t(c1 int); |
| 7 |
CREATE TABLE IF NOT EXISTS t1 LIKE t; |
| 8 |
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t; |
| 9 |
CREATE EVENT IF NOT EXISTS e |
| 10 |
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR |
| 11 |
DO SELECT now(); |
| 12 |
connection slave; |
| 13 |
connection slave; |
| 14 |
DROP DATABASE mysqltest; |
| 15 |
connection master; |
| 16 |
CREATE DATABASE IF NOT EXISTS mysqltest; |
| 17 |
USE mysqltest; |
| 18 |
CREATE TABLE IF NOT EXISTS t(c1 int); |
| 19 |
CREATE TABLE IF NOT EXISTS t1 LIKE t; |
| 20 |
CREATE TABLE IF NOT EXISTS t2 SELECT * FROM t; |
| 21 |
CREATE EVENT IF NOT EXISTS e |
| 22 |
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR |
| 23 |
DO SELECT now(); |
| 24 |
connection slave; |
| 25 |
connection slave; |
| 26 |
SHOW TABLES in mysqltest; |
| 27 |
Tables_in_mysqltest |
| 28 |
SHOW EVENTS in mysqltest; |
| 29 |
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation |
| 30 |
mysqltest e root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci |
| 31 |
connection master; |
| 32 |
DROP DATABASE IF EXISTS mysqltest; |
| 33 |
-------------BUG#47418------------- |
| 34 |
connection master; |
| 35 |
USE test; |
| 36 |
DROP TABLE IF EXISTS t3; |
| 37 |
CREATE TABLE t3(c1 INTEGER); |
| 38 |
INSERT INTO t3 VALUES(33); |
| 39 |
CREATE TEMPORARY TABLE t1(c1 INTEGER); |
| 40 |
CREATE TEMPORARY TABLE t2(c1 INTEGER); |
| 41 |
INSERT INTO t1 VALUES(1); |
| 42 |
INSERT INTO t2 VALUES(1); |
| 43 |
CREATE TABLE IF NOT EXISTS t1(c1 INTEGER) SELECT c1 FROM t3; |
| 44 |
CREATE TABLE t2(c1 INTEGER) SELECT c1 FROM t3; |
| 45 |
SELECT * FROM t1; |
| 46 |
c1 |
| 47 |
1 |
| 48 |
SELECT * FROM t2; |
| 49 |
c1 |
| 50 |
1 |
| 51 |
connection slave; |
| 52 |
SELECT * FROM t1; |
| 53 |
c1 |
| 54 |
33 |
| 55 |
SELECT * FROM t2; |
| 56 |
c1 |
| 57 |
33 |
| 58 |
connection master; |
| 59 |
DROP TEMPORARY TABLE t1; |
| 60 |
DROP TEMPORARY TABLE t2; |
| 61 |
SELECT * FROM t1; |
| 62 |
c1 |
| 63 |
33 |
| 64 |
SELECT * FROM t2; |
| 65 |
c1 |
| 66 |
33 |
| 67 |
DROP TABLE t1; |
| 68 |
DROP TABLE t2; |
| 69 |
DROP TABLE t3; |
| 70 |
# WL#5370 |
| 71 |
# The behavior of statement 'CREATE TABLE SELECT IF NOT EXISTS' is changed. |
| 72 |
# After the worklog, it will insert nothing and the statement will not be |
| 73 |
# binlogged if the table already exists. |
| 74 |
# After the worklog, some bugs will disappear automotically. |
| 75 |
include/rpl_reset.inc |
| 76 |
|
| 77 |
# Case 1: BUG#47132 |
| 78 |
connection master; |
| 79 |
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*"); |
| 80 |
CREATE TABLE t1 (id int); |
| 81 |
CREATE TABLE t2 (id int); |
| 82 |
INSERT INTO t1 VALUES (1), (1); |
| 83 |
INSERT INTO t2 VALUES (2), (2); |
| 84 |
CREATE VIEW v1 AS SELECT id FROM t2; |
| 85 |
CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id as di FROM t1; |
| 86 |
Warnings: |
| 87 |
Note 1050 Table 'v1' already exists |
| 88 |
include/show_binlog_events.inc |
| 89 |
SHOW CREATE TABLE v1; |
| 90 |
View Create View character_set_client collation_connection |
| 91 |
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t2`.`id` AS `id` from `t2` latin1 latin1_swedish_ci |
| 92 |
SELECT * FROM t2; |
| 93 |
id |
| 94 |
2 |
| 95 |
2 |
| 96 |
SELECT * FROM v1; |
| 97 |
id |
| 98 |
2 |
| 99 |
2 |
| 100 |
DROP VIEW v1; |
| 101 |
CREATE TEMPORARY TABLE tt1 AS SELECT id FROM t2; |
| 102 |
CREATE TEMPORARY TABLE IF NOT EXISTS tt1(a int, b int) SELECT id, id FROM t1; |
| 103 |
Warnings: |
| 104 |
Note 1050 Table 'tt1' already exists |
| 105 |
include/show_binlog_events.inc |
| 106 |
SELECT * FROM t2; |
| 107 |
id |
| 108 |
2 |
| 109 |
2 |
| 110 |
SELECT * FROM tt1; |
| 111 |
id |
| 112 |
2 |
| 113 |
2 |
| 114 |
DROP TEMPORARY TABLE tt1; |
| 115 |
|
| 116 |
# Case 1: BUG#47132 |
| 117 |
# RBR breaks on CREATE TABLE IF EXISTS <existing VIEW> AS SELECT |
| 118 |
CREATE VIEW v1 AS SELECT 1 as a; |
| 119 |
CREATE TABLE IF NOT EXISTS v1 SELECT 2 as a; |
| 120 |
Warnings: |
| 121 |
Note 1050 Table 'v1' already exists |
| 122 |
include/show_binlog_events.inc |
| 123 |
connection slave; |
| 124 |
connection master; |
| 125 |
DROP VIEW v1; |
| 126 |
DROP TABLE t1, t2; |
| 127 |
# |
| 128 |
# Test case which has failed on assertion after refactoring which was |
| 129 |
# made as part of fix for bug #27480 "Extend CREATE TEMPORARY TABLES |
| 130 |
# privilege to allow temp table operations". |
| 131 |
# |
| 132 |
CREATE TEMPORARY TABLE t1 (id int); |
| 133 |
CREATE TABLE IF NOT EXISTS t2 LIKE t1; |
| 134 |
# The below statement should succeed with warning and |
| 135 |
# should not crash due to failing assertion. |
| 136 |
CREATE TABLE IF NOT EXISTS t2 LIKE t1; |
| 137 |
Warnings: |
| 138 |
Note 1050 Table 't2' already exists |
| 139 |
# Clean-up. |
| 140 |
DROP TABLE t1, t2; |
| 141 |
connection slave; |
| 142 |
connection master; |
| 143 |
include/rpl_end.inc |