summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera/r/galera_fk_setnull.result
blob: d4f20fe60a3c59f5d1f6bed51f0ebc6bc7beddbe (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
CREATE TABLE parent (
id INT NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE child (
id INT, 
parent_id INT,
FOREIGN KEY (parent_id) 
REFERENCES parent(id)
ON UPDATE SET NULL
ON DELETE SET NULL
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1),(2);
INSERT INTO child VALUES (1,1),(2,2);
connection node_2;
DELETE FROM parent WHERE id = 1;
SELECT parent_id IS NULL FROM child WHERE id = 1;
parent_id IS NULL
1
connection node_1;
SELECT parent_id IS NULL FROM child WHERE id = 1;
parent_id IS NULL
1
UPDATE parent SET id = 3 WHERE id = 2;
SELECT parent_id IS NULL FROM child WHERE id = 2;
parent_id IS NULL
1
connection node_2;
SELECT parent_id IS NULL FROM child WHERE id = 2;
parent_id IS NULL
1
connection node_1;
DROP TABLE child;
DROP TABLE parent;