~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to mysql-test/extra/rpl_tests/rpl_foreign_key.test

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Check the replication of the FOREIGN_KEY_CHECKS variable.
 
2
 
 
3
-- source include/master-slave.inc
 
4
 
 
5
eval CREATE TABLE t1 (a INT AUTO_INCREMENT KEY) ENGINE=$engine_type;
 
6
eval CREATE TABLE t2 (b INT AUTO_INCREMENT KEY, c INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=$engine_type;
 
7
 
 
8
SET FOREIGN_KEY_CHECKS=0;
 
9
INSERT INTO t1 VALUES (10);
 
10
INSERT INTO t1 VALUES (NULL),(NULL),(NULL);
 
11
INSERT INTO t2 VALUES (5,0);
 
12
INSERT INTO t2 VALUES (NULL,LAST_INSERT_ID());
 
13
SET FOREIGN_KEY_CHECKS=1;
 
14
SELECT * FROM t1 ORDER BY a;
 
15
SELECT * FROM t2 ORDER BY b;
 
16
sync_slave_with_master;
 
17
SELECT * FROM t1 ORDER BY a;
 
18
SELECT * FROM t2 ORDER BY b;
 
19
 
 
20
connection master;
 
21
SET TIMESTAMP=1000000000;
 
22
CREATE TABLE t3 ( a INT UNIQUE );
 
23
SET FOREIGN_KEY_CHECKS=0;
 
24
# Had to add 1022 for run with ndb as ndb uses different
 
25
# error and error code for error ER_DUP_ENTRY. Bug 16677
 
26
--error 1022, ER_DUP_ENTRY
 
27
INSERT INTO t3 VALUES (1),(1);
 
28
sync_slave_with_master;
 
29
 
 
30
connection master;
 
31
SET FOREIGN_KEY_CHECKS=0;
 
32
DROP TABLE IF EXISTS t1,t2,t3;
 
33
SET FOREIGN_KEY_CHECKS=1;
 
34
sync_slave_with_master;
 
35
 
 
36
#
 
37
# Bug #32468 delete rows event on a table with foreign key constraint fails
 
38
#
 
39
 
 
40
connection master;
 
41
 
 
42
eval create table t1 (b int primary key) engine = $engine_type;
 
43
eval create table t2 (a int primary key, b int, foreign key (b) references t1(b))
 
44
       engine = $engine_type;
 
45
 
 
46
insert into t1 set b=1;
 
47
insert into t2 set a=1, b=1;
 
48
 
 
49
set foreign_key_checks=0;
 
50
set @@session.binlog_format=row;
 
51
delete from t1;
 
52
 
 
53
--echo must sync w/o a problem (could not with the buggy code)
 
54
sync_slave_with_master;
 
55
select count(*) from t1 /* must be zero */;
 
56
 
 
57
 
 
58
# cleanup for bug#32468
 
59
 
 
60
connection master;
 
61
drop table t2,t1;
 
62
 
 
63
sync_slave_with_master;
 
64
 
 
65