Bug #14981 Adding ForeignKey with a duplicated name should show a proper error message
Submitted: 16 Nov 2005 12:54 Modified: 17 Nov 2005 11:22
Reporter: Alexandre Gomes Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S4 (Feature request)
Version: OS:
Assigned to: CPU Architecture:Any

[16 Nov 2005 12:54] Alexandre Gomes
When trying to add a foreign key with a name that already exists the error that mysql produces is:
ERROR 1216 (23000): Cannot add or update a child row: a foreign key constraint fails

And should be something more usefull like "That name already exists..."

How to repeat:
Create a table with a foreign key called "ABC". Try to add a foreign key to another table where the foreign key is called "ABC".

Suggested fix:
Proper error.
[16 Nov 2005 14:32] Heikki Tuuri

Please use:


to display a detailed explanation of the latest foreign key error.

Better error messages are in the TODO.


[17 Nov 2005 11:22] Jan Lindström
Duplicate of bug #13431.