Debian Codegraph @

mysql-test/suite/rpl/t/rpl_drop_db_fail.test

raw
1 ###############################################################################
2 # Bug#20041860: SLAVE ERROR WHEN DROP DATABASE
3 #
4 # Test:
5 # =====
6 # Create two databases such that one database has a dependency over the other
7 # database and try to drop the database which has a dependency. This should
8 # not cause slave to break.
9 ###############################################################################
10 --source include/not_group_replication_plugin.inc
11 --source include/set_privilege_checks_user_as_system_user.inc
12 --source include/master-slave.inc
13
14 connection master;
15 CREATE DATABASE IF NOT EXISTS db1;
16 CREATE DATABASE IF NOT EXISTS db2;
17
18 use db1;
19 CREATE TABLE a(id INT);
20 CREATE VIEW v AS SELECT * FROM a;
21 CREATE TABLE table_father(id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(20)) ENGINE=INNODB;
22 --source include/sync_slave_sql_with_master.inc
23
24 connection master;
25 use db2;
26 CREATE TABLE table_child(id INT PRIMARY KEY, info VARCHAR(20), father_id INT) ENGINE=INNODB;
27 ALTER TABLE table_child ADD CONSTRAINT aaa FOREIGN KEY (father_id) REFERENCES db1.table_father(id);
28
29 --error ER_FK_CANNOT_DROP_PARENT
30 DROP DATABASE db1;
31 DROP DATABASE db2;
32 --source include/sync_slave_sql_with_master.inc
33 --connection master
34 DROP DATABASE db1;
35 --source include/rpl_end.inc