| 1 |
# Test Bug #57255. Cascade deletes that affect different rows should not |
| 2 |
# result in DB_FOREIGN_EXCEED_MAX_CASCADE error |
| 3 |
|
| 4 |
|
| 5 |
create table A(id int not null primary key) engine=innodb; |
| 6 |
|
| 7 |
create table B(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references A(id) on delete cascade) engine=innodb; |
| 8 |
|
| 9 |
create table C(id int not null auto_increment primary key, f1 int not null, foreign key(f1) references B(id) on delete cascade) engine=innodb; |
| 10 |
|
| 11 |
insert into A values(1), (2); |
| 12 |
|
| 13 |
--disable_query_log |
| 14 |
begin; |
| 15 |
let $i=257; |
| 16 |
while ($i) |
| 17 |
{ |
| 18 |
insert into B(f1) values(1); |
| 19 |
dec $i; |
| 20 |
} |
| 21 |
let $i=486; |
| 22 |
while ($i) |
| 23 |
{ |
| 24 |
insert into C(f1) values(2); |
| 25 |
dec $i; |
| 26 |
} |
| 27 |
commit; |
| 28 |
--enable_query_log |
| 29 |
|
| 30 |
# Following Deletes should not report error |
| 31 |
DELETE FROM A where id = 1; |
| 32 |
DELETE FROM C where f1 = 2; |
| 33 |
DELETE FROM A where id = 1; |
| 34 |
|
| 35 |
DROP TABLE C; |
| 36 |
DROP TABLE B; |
| 37 |
DROP TABLE A; |