Bug #43852 Unable to create foreign key constraint
Submitted: 25 Mar 2009 8:13 Modified: 25 Apr 2009 9:06
Reporter: Mike Cook Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Errors Severity:S2 (Serious)
Version:5.1 OS:Windows
Assigned to: CPU Architecture:Any

[25 Mar 2009 8:13] Mike Cook
Description:
If you try and create a foreign key constraint with the same name as an existing one it will fail with a 'constraint already exists' error.

How to repeat:
After this you can no longer create constraints to the same parent table and receive the errno:150 error.

If you then drop the parent table and recreate it, mySQL will then allow you to add the FK constaints successfully.

Suggested fix:
This appears to be a reference left in the mySQL reference data which should be cleaned up when the constraint creation fails.
[25 Mar 2009 9:06] Sveta Smirnova
Thank you for the report.

> This appears to be a reference left in the mySQL reference data which should be cleaned up
> when the constraint creation fails.

This is generally not true. Please provide repeatable test case, so we can see if it was result of a bug or just usage mistake.
[25 Apr 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".