Bug #46363 Foreign key name collision - two foreign keys with the same name
Submitted: 24 Jul 2009 10:22 Modified: 28 Aug 2009 7:00
Reporter: Petr Burian Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.1.16 OS:Any
Assigned to: Alexander Musienko CPU Architecture:Any
Tags: foreign key, name collision

[24 Jul 2009 10:22] Petr Burian
Description:
When I create a N:M identifying relationship on a single table I get foregin key name collision - both keys are named exactly the same.

MySQL server doesn't allow multiple foreign keys with the same names.

How to repeat:
See attached model.

Create table participant with primary key (participant.id). Next create N:M relationship on participant.id. Table participant_has_participant is created. Now open this table and take a look to Foreign keys tab. There are two foreign keys with the same name.

Suggested fix:
Just add index [1..n] after a foreign key name.
[24 Jul 2009 10:23] Petr Burian
Foreign keys have the same name

Attachment: foreign-keys.mwb (application/octet-stream, text), 4.94 KiB.

[24 Jul 2009 10:33] Valeriy Kravchuk
Thank you for the bug report. Verified just as described on Mac OS X.
[27 Aug 2009 14:46] Johannes Taxacher
now a trailing number is added to the name if it already exists.
fix will be included in 5.1.18
[28 Aug 2009 7:00] Tony Bedford
An entry has been added to the 5.1.18 changelog:

When a N:M identifying relationship was created on a single table, a foreign key name collision occurred - both keys were given the same name. MySQL Workbench has been changed so that key names have a trailing number added to avoid conflicts.