summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl/t/rpl_drop_db_fail.test
blob: f4482064d7b78e43a7ca8a872185d3a71b72037d (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
###############################################################################
# Bug#20041860: SLAVE ERROR WHEN DROP DATABASE
#
# Test:
# =====
# Create two databases such that one database has a dependency over the other
# database and try to drop the database which has a dependency. This should
# not cause slave to break.
###############################################################################
--source include/have_innodb.inc
--source include/master-slave.inc

connection master;
CREATE DATABASE IF NOT EXISTS db1;
CREATE DATABASE IF NOT EXISTS db2;

use db1;
CREATE TABLE a(id INT);
CREATE VIEW v AS SELECT * FROM a;
CREATE TABLE table_father(id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(20)) ENGINE=INNODB;
--sync_slave_with_master

connection master;
use db2;
CREATE TABLE table_child(id INT PRIMARY KEY, info VARCHAR(20), father_id INT) ENGINE=INNODB;
ALTER TABLE table_child ADD CONSTRAINT aaa FOREIGN KEY (father_id) REFERENCES db1.table_father(id);

--error ER_ROW_IS_REFERENCED
DROP DATABASE db1;
DROP DATABASE db2;
--sync_slave_with_master
--connection master
DROP DATABASE db1;
--source include/rpl_end.inc