Bug #38169 Innodb ignores CASCADE on drop tables
Submitted: 16 Jul 2008 11:14 Modified: 18 Jul 2008 12:24
Reporter: Susanne Ebrecht Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: CPU Architecture:Any

[16 Jul 2008 11:14] Susanne Ebrecht
Description:
drop table t,t1 cascade;
ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails

According to documentation:
DROP [TEMPORARY] TABLE [IF EXISTS]
    tbl_name [, tbl_name] ...
    [RESTRICT | CASCADE]

Using non strict mode CASCADE should be default, using strict mode RESTRICT should be default.

I used non strict mode and CASCADE failed also when you explicit add it at drop statement.

How to repeat:
create table t(id serial) engine=innodb;
create table t1(i bigint(20) unsigned, foreign key(i) references t(id))engine=innodb;

drop table t,t1 cascade;

Suggested fix:
...
[16 Jul 2008 11:31] Susanne Ebrecht
Ok, it's documented that CASCADE is doing nothing in 5.1