1#
2# Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE ADD
3# FOREIGN KEY
4#
5CREATE TABLE `parent` (`parent_id` INT, PRIMARY KEY (`parent_id`));
6CREATE TABLE `child1` (`id` INT ,`child1_fk1` INT, `child1_fk2` INT,
7PRIMARY KEY (`id`));
8CREATE TABLE `child2` (`id` INT, `child2_fk1` INT, `child2_fk2` INT,
9PRIMARY KEY (`id`));
10CREATE TABLE `child3` (`id` INT , `child3_fk1` INT, PRIMARY KEY (`id`));
11ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk1`) REFERENCES `parent`
12(`parent_id`);
13ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk1`) REFERENCES
14`parent` (`parent_id`);
15ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk2`) REFERENCES `parent`
16(`parent_id`);
17ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk1`) REFERENCES `parent`
18(`parent_id`);
19ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk2`) REFERENCES `parent`
20(`parent_id`);
21ALTER TABLE `child3` ADD FOREIGN KEY (`child3_fk1`) REFERENCES `parent`
22(`parent_id`);
23ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk2`) REFERENCES
24`parent` (`parent_id`);
25ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk1`) REFERENCES
26`parent` (`parent_id`);
27ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk2`) REFERENCES
28`parent` (`parent_id`);
29ALTER TABLE `child3` ADD FOREIGN KEY (`child3_fk1`) REFERENCES
30`parent` (`parent_id`);
31drop table child3, child2, child1, parent;
32