mariadb/mysql-test/suite/galera/r/galera_fk_mismatch.result
2014-09-30 18:06:15 -04:00

25 lines
604 B
Text

CREATE TABLE parent (
id1 INT,
id2 INT,
PRIMARY KEY (id1, id2) /* Multipart PK */
) ENGINE=InnoDB;
CREATE TABLE child (
id INT PRIMARY KEY,
parent_id1 INT,
FOREIGN KEY (parent_id1)
REFERENCES parent(id1) /* FK is subset of PK above */
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1, 2);
INSERT INTO child VALUES (1, 1);
UPDATE parent SET id1 = 3 WHERE id1 = 1;
SELECT COUNT(*) = 1 FROM child WHERE parent_id1 = 3;
COUNT(*) = 1
1
DELETE FROM parent WHERE id1 = 3;
SELECT COUNT(*) = 0 FROM child WHERE parent_id1 = 3;
COUNT(*) = 0
1
DROP TABLE child;
DROP TABLE parent;