Debian Codegraph @

mysql-test/suite/galera/t/galera_fk_multitable.test

raw
1 #
2 # Test multi-table DELETE in the presence of FKs
3 #
4
5 --source include/galera_cluster.inc
6 --source include/have_innodb.inc
7
8 CREATE TABLE t0 (
9 f0 INT PRIMARY KEY
10 );
11
12 CREATE TABLE t1 (
13 f1 INT PRIMARY KEY,
14 f0 INTEGER,
15 FOREIGN KEY (f0)
16 REFERENCES t0(f0)
17 ON DELETE CASCADE
18 );
19
20 INSERT INTO t0 VALUES (0), (1);
21 INSERT INTO t1 VALUES (0, 0);
22 INSERT INTO t1 VALUES (1, 0);
23
24 --connection node_2
25 DELETE t0.*, t1.* FROM t0, t1 WHERE t0.f0 = 0 AND t1.f1 = 0;
26
27 --connection node_1
28 SELECT COUNT(*) = 1 FROM t0;
29 SELECT COUNT(*) = 0 FROM t1;
30
31 DROP TABLE t1;
32 DROP TABLE t0;