diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
commit | 06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/galera/t/galera_fk_setnull.test | |
parent | Initial commit. (diff) | |
download | mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/galera/t/galera_fk_setnull.test')
-rw-r--r-- | mysql-test/suite/galera/t/galera_fk_setnull.test | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/suite/galera/t/galera_fk_setnull.test b/mysql-test/suite/galera/t/galera_fk_setnull.test new file mode 100644 index 00000000..46ba82db --- /dev/null +++ b/mysql-test/suite/galera/t/galera_fk_setnull.test @@ -0,0 +1,36 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +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; + +--connection node_1 +SELECT parent_id IS NULL FROM child WHERE id = 1; + +UPDATE parent SET id = 3 WHERE id = 2; +SELECT parent_id IS NULL FROM child WHERE id = 2; + +--connection node_2 +SELECT parent_id IS NULL FROM child WHERE id = 2; + +--connection node_1 +DROP TABLE child; +DROP TABLE parent; |