Bug #69008 | Drop database not working in presence of foreign keys | ||
---|---|---|---|
Submitted: | 19 Apr 2013 9:48 | Modified: | 29 May 2013 16:45 |
Reporter: | Sébastien Barré | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Cluster: Cluster (NDB) storage engine | Severity: | S2 (Serious) |
Version: | 7.3.1 m2 | OS: | Windows ( (Server 2008 R2 64-bit)) |
Assigned to: | CPU Architecture: | Any |
[19 Apr 2013 9:48]
Sébastien Barré
[19 Apr 2013 11:56]
MySQL Verification Team
Hello Sébastien Barré, Thank you for the report. Verified as described. Thanks, Umesh
[19 Apr 2013 11:57]
MySQL Verification Team
## How to repeat create database defect_69008; use defect_69008 create table fktest (id int primary key) engine=ndb; create table fktest2 (id int, name varchar(30), foreign key(id) references fktest(id)) engine=ndb; drop database defect69008; show tables; show warnings; create database defect69008; ### using NDB tables mysql> select version(); +------------------------------+ | version() | +------------------------------+ | 5.6.10-ndb-7.3.1-cluster-gpl | +------------------------------+ 1 row in set (0.00 sec) mysql> use defect_69008 Database changed mysql> create table fktest (id int primary key) engine=ndb; Query OK, 0 rows affected (1.02 sec) mysql> create table fktest2 (id int, name varchar(30), foreign key(id) references fktest(id)) engine=ndb; Query OK, 0 rows affected (1.11 sec) mysql> mysql> drop database defect_69008; ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails mysql> mysql> show errors; +-------+------+----------------------------------------------------------------------+ | Level | Code | Message | +-------+------+----------------------------------------------------------------------+ | Error | 1217 | Cannot delete or update a parent row: a foreign key constraint fails | +-------+------+----------------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> show warnings; +---------+------+-------------------------------------------------------------------------------------------------------+ | Level | Code | Message | +---------+------+-------------------------------------------------------------------------------------------------------+ | Warning | 1296 | Got error 21080 'Drop table not allowed in NDB - referenced by foreign key on another table' from NDB | | Error | 1217 | Cannot delete or update a parent row: a foreign key constraint fails | +---------+------+-------------------------------------------------------------------------------------------------------+ 2 rows in set (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | defect_69008 | | mysql | | ndbinfo | | performance_schema | +--------------------+ 5 rows in set (0.00 sec) mysql>
[19 Apr 2013 11:58]
MySQL Verification Team
### using Innodb tables - works as expected mysql> create database defect_69008in; Query OK, 1 row affected (0.00 sec) mysql> use defect_69008in Database changed mysql> create table fktest (id int primary key) engine=innodb; Query OK, 0 rows affected (0.03 sec) mysql> create table fktest2 (id int, name varchar(30), foreign key(id) references fktest(id)) engine=innodb; Query OK, 0 rows affected (0.11 sec) mysql> mysql> drop database defect_69008in; Query OK, 2 rows affected (0.03 sec) mysql>
[2 May 2013 4:23]
MySQL Verification Team
bug #69116 looks the same
[28 May 2013 4:33]
Jonas Oreland
Posted by developer: Committed fix for 7.3.2
[29 May 2013 16:45]
Jon Stephens
Documented fix in the NDB 7.3.2 changelog as follows: DROP DATABASE failed to work correctly when executed against a database containing NDB tables joined by foreign keys, leaving these tables in place while dropping the remaining tables in the database and reporting failure. Closed.
[19 Mar 2014 19:19]
James Briggs
This bug is still present in MySQL Cluster 7.3.3, though it is intermittent. James.