Bug #53370 Index and foreign key names cannot be different when it's edited in mysqlWB
Submitted: 3 May 2010 12:14 Modified: 11 May 2010 15:39
Reporter: Papil Mach Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.16 OSS Beta rev5249, 5.2.20 OS:Any (Vista 64bit SP2, Mac OS X)
Assigned to: Alfredo Kojima CPU Architecture:Any
Tags: foreign key, INDEX, name, naming

[3 May 2010 12:14] Papil Mach
Description:
Index names and foreign key names of a column cannot be different when you edit the name of one of these with mysql workbench.

How to repeat:
1 - Create a table with a foreign key.
2 - Edit the foreign key name of the column COL (let's say FK_COL)
3 - Edit the index name of the column COL (let's say X_COL)

==> the foreign key name has changed. (It is now X_COL)

[The same thing happens if you do step3 before step2]
[3 May 2010 15:38] Valeriy Kravchuk
Thank you for the problem report. Verified just as described with a recent version, 5.2.20.
[4 May 2010 7:26] Papil Mach
I have verified with 5.2.20 beta10 and the problem is still there.
[4 May 2010 9:53] Johannes Taxacher
this is slightly related to Bug #53277
[4 May 2010 11:13] Papil Mach
I haven't seen this bug.
I think that both bugs are correlated in the implementation of MysqlWB, nevertheless I think they are completely different.

Bug 53277 : two indexes are created although one would be enough.
Bug 53370 : the bug concerns their names.

Maybe I'm wrong...?
[4 May 2010 14:51] Alfredo Kojima
Changed it so that renaming an index will not rename a FK but renaming a FK will rename the
associated index only if the names still match at the time the FK is renamed.
[5 May 2010 7:54] Papil Mach
It will be better, but I think that FK and index names should be different when MySQL-WB creates them. 

Having same names for FK and indexes doesn't seem normal to me (maybe I'm wrong?). Even if they are associated, they are totally different. 
It can be useful to distinguish them in SQL errors for example.

-----------------
Foreign keys : FK_ prefix
Indexes : IDX_ prefix (or something like that)
-----------------

Anyway, thanks again.
[11 May 2010 15:39] Tony Bedford
An entry has been added to the 5.2.21 changelog:

It was not possible for the index name and foreign key name of a column to be given different names in MySQL Workbench.

MySQL Workbench has been changed so that renaming an index will not automatically rename a corresponding foreign key. However, renaming a foreign key will automatically rename the associated index only if the names still match at the time the foreign key is renamed.