Commit dfa9012a authored by Daniele Sciascia's avatar Daniele Sciascia Committed by Nirbhay Choubey

MW-285 MTR test case for broken foreign key constraints

parent c9ac48f8
CREATE TABLE parent1 ( id INT PRIMARY KEY, KEY (id) ) ENGINE=InnoDB;
CREATE TABLE parent2 ( id INT PRIMARY KEY, KEY (id) ) ENGINE=InnoDB;
CREATE TABLE child (
id INT PRIMARY KEY,
parent1_id INT,
parent2_id INT,
FOREIGN KEY (parent1_id) REFERENCES parent1(id),
FOREIGN KEY (parent1_id) REFERENCES parent2(id)
) ENGINE=InnoDB;
INSERT INTO parent1 VALUES (1);
INSERT INTO parent2 VALUES (1);
INSERT INTO child VALUES (1,1,1);
INSERT INTO child VALUES (2,1,1);
SET foreign_key_checks=OFF;
DROP TABLE parent1;
UPDATE child SET parent1_id=2 WHERE id=1;
DROP TABLE child;
DROP TABLE parent2;
SET foreign_key_checks=ON;
#
# Broken FK constraints cause assertions
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE parent1 ( id INT PRIMARY KEY, KEY (id) ) ENGINE=InnoDB;
CREATE TABLE parent2 ( id INT PRIMARY KEY, KEY (id) ) ENGINE=InnoDB;
CREATE TABLE child (
id INT PRIMARY KEY,
parent1_id INT,
parent2_id INT,
FOREIGN KEY (parent1_id) REFERENCES parent1(id),
FOREIGN KEY (parent1_id) REFERENCES parent2(id)
) ENGINE=InnoDB;
INSERT INTO parent1 VALUES (1);
INSERT INTO parent2 VALUES (1);
INSERT INTO child VALUES (1,1,1);
INSERT INTO child VALUES (2,1,1);
SET foreign_key_checks=OFF;
DROP TABLE parent1;
UPDATE child SET parent1_id=2 WHERE id=1;
DROP TABLE child;
DROP TABLE parent2;
SET foreign_key_checks=ON;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment