Debian Codegraph @

mysql-test/suite/ndb/r/ndb_fk_restrict.result

raw
1 create table parent (
2 a int primary key auto_increment,
3 b int not null,
4 c int not null,
5 unique(b) using hash,
6 index(c)) engine = ndb;
7 create table child (
8 a int primary key auto_increment,
9 b int not null,
10 c int not null,
11 unique(b) using hash,
12 index(c)) engine = ndb;
13 alter table child add constraint fkname foreign key (a) references parent(a) on delete restrict on update restrict;
14 insert into parent values (1,1,1);
15 insert into child values (1,1,1);
16 insert into child values (2,2,2);
17 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT)
18 begin;
19 delete from parent;
20 ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT)
21 rollback;
22 delete from child;
23 delete from parent;
24 begin;
25 insert into child values (2,2,2);
26 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT)
27 rollback;
28 delete from child;
29 delete from parent;
30 insert into parent values (1,1,1);
31 begin;
32 insert into child values (1,1,1);
33 begin;
34 delete from parent;
35 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
36 commit;
37 commit;
38 delete from child;
39 delete from parent;
40 alter table child drop foreign key fkname;
41 alter table child add constraint fkname foreign key (b) references parent(a) on delete restrict on update restrict;
42 insert into parent values (1,1,1);
43 insert into child values (1,1,1);
44 insert into child values (2,2,2);
45 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`b`) REFERENCES `parent` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT)
46 update child set b = 2 where a = 1;
47 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`b`) REFERENCES `parent` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT)
48 begin;
49 delete from parent;
50 ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`b`) REFERENCES `parent` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT)
51 rollback;
52 delete from child;
53 delete from parent;
54 begin;
55 insert into child values (2,2,2);
56 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`b`) REFERENCES `parent` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT)
57 rollback;
58 delete from child;
59 delete from parent;
60 insert into parent values (1,1,1);
61 begin;
62 insert into child values (1,1,1);
63 begin;
64 delete from parent;
65 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
66 commit;
67 commit;
68 delete from child;
69 delete from parent;
70 alter table child drop foreign key fkname;
71 alter table child add constraint fkname foreign key (a) references parent(b) on delete restrict on update restrict;
72 insert into parent values (1,1,1);
73 insert into child values (1,1,1);
74 insert into child values (2,2,2);
75 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`a`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
76 update parent set b = 2 where a = 1;
77 ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`a`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
78 begin;
79 delete from parent;
80 ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`a`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
81 rollback;
82 delete from child;
83 delete from parent;
84 begin;
85 insert into child values (2,2,2);
86 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`a`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
87 rollback;
88 delete from child;
89 delete from parent;
90 insert into parent values (1,1,1);
91 begin;
92 insert into child values (1,1,1);
93 begin;
94 delete from parent;
95 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
96 commit;
97 commit;
98 delete from child;
99 delete from parent;
100 alter table child drop foreign key fkname;
101 alter table child add constraint fkname foreign key (b) references parent(b) on delete restrict on update restrict;
102 insert into parent values (1,1,1);
103 insert into child values (1,1,1);
104 update child set b = 2 where a = 1;
105 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`b`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
106 insert into child values (2,2,2);
107 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`b`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
108 update parent set b = 2 where a = 1;
109 ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`b`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
110 begin;
111 delete from parent;
112 ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`b`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
113 rollback;
114 delete from child;
115 delete from parent;
116 begin;
117 insert into child values (2,2,2);
118 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`b`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
119 rollback;
120 delete from child;
121 delete from parent;
122 insert into parent values (1,1,1);
123 begin;
124 insert into child values (1,1,1);
125 begin;
126 delete from parent;
127 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
128 commit;
129 commit;
130 delete from child;
131 delete from parent;
132 alter table child drop foreign key fkname;
133 alter table child add constraint fkname foreign key (c) references parent(a) on delete restrict on update restrict;
134 insert into parent values (1,1,1);
135 insert into child values (1,1,1);
136 update child set c = 2 where a = 1;
137 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`c`) REFERENCES `parent` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT)
138 insert into child values (2,2,2);
139 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`c`) REFERENCES `parent` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT)
140 begin;
141 delete from parent;
142 ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`c`) REFERENCES `parent` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT)
143 rollback;
144 delete from child;
145 delete from parent;
146 begin;
147 insert into child values (2,2,2);
148 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`c`) REFERENCES `parent` (`a`) ON DELETE RESTRICT ON UPDATE RESTRICT)
149 rollback;
150 delete from child;
151 delete from parent;
152 insert into parent values (1,1,1);
153 begin;
154 insert into child values (1,1,1);
155 begin;
156 delete from parent;
157 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
158 commit;
159 commit;
160 delete from child;
161 delete from parent;
162 alter table child drop foreign key fkname;
163 alter table child add constraint fkname foreign key (c) references parent(b) on delete restrict on update restrict;
164 insert into parent values (1,1,1);
165 insert into child values (1,1,1);
166 update child set c = 2 where a = 1;
167 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`c`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
168 insert into child values (2,2,2);
169 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`c`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
170 update parent set b = 2 where a = 1;
171 ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`c`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
172 begin;
173 delete from parent;
174 ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`c`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
175 rollback;
176 delete from child;
177 delete from parent;
178 begin;
179 insert into child values (2,2,2);
180 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `fkname` FOREIGN KEY (`c`) REFERENCES `parent` (`b`) ON DELETE RESTRICT ON UPDATE RESTRICT)
181 rollback;
182 delete from child;
183 delete from parent;
184 insert into parent values (1,1,1);
185 begin;
186 insert into child values (1,1,1);
187 begin;
188 delete from parent;
189 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
190 commit;
191 commit;
192 delete from child;
193 delete from parent;
194 alter table child drop foreign key fkname;
195 drop table parent, child;