Bug #42416 can't drop FOREIGN KEY : error on rename of
Submitted: 28 Jan 2009 12:08 Modified: 28 Jan 2009 15:45
Reporter: James b Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version: 5.0.51a-3ubuntu5.4 (Ubuntu) OS:Linux
Assigned to: CPU Architecture:Any

[28 Jan 2009 12:08] James b
Description:
see below

I have seen http://bugs.mysql.com/bug.php?id=14347 but it doesn't seem to provide an answer.

How to repeat:
mysql> create database testing;
Query OK, 1 row affected (0.00 sec)

mysql> use testing;
Database changed
mysql> CREATE TABLE IF NOT EXISTS CollectionInfo (
    -> CollectionName VARCHAR(255) NOT NULL PRIMARY KEY
    -> )  ENGINE=InnoDB;
Query OK, 0 rows affected (0.01 sec)

mysql> 
mysql> 
mysql> CREATE TABLE IF NOT EXISTS CollectionRequestHandler (
    -> ID INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
    -> CollectionName VARCHAR(255),
    -> CONSTRAINT `crh_cn` FOREIGN KEY (CollectionName) REFERENCES CollectionInfo(CollectionName) ON DELETE CASCADE
    -> )  ENGINE=InnoDB;
Query OK, 0 rows affected (0.00 sec)

mysql> 
mysql> ALTER TABLE CollectionInfo DROP FOREIGN KEY `crh_cn`;
ERROR 1025 (HY000): Error on rename of './testing/CollectionInfo' to './testing/#sql2-1907-ed' (errno: 152)
[28 Jan 2009 15:45] Valeriy Kravchuk
Thank you for a problem report. I had re-opened and verified that Bug #14347. This is a duplicate.