Bug #37273 Change order index
Submitted: 9 Jun 2008 6:58 Modified: 1 Jul 2009 10:28
Reporter: Radboud Platvoet Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.0 OS:Windows
Assigned to: Alfredo Kojima CPU Architecture:Any
Tags: Change order index, CHECKED

[9 Jun 2008 6:58] Radboud Platvoet
Description:
It is not possible to change the order of the fields within an index using the dropdown numbers in the '#' column of the 'index' tab of the edit table area window. Since there is a dropdown box programmed you would expect the index field order to change if you use it to select a different number using that dropdown box. However, it always jumps back to it's original value.

Works on not-primary and not-foreign indexes...

How to repeat:
Create a table.
Create three columns (c1, c2, c3).
Make each column part of the primary key.
Go to the 'index' tab.
Select the primary key.
Select the '#' column of field c2 and try to change the number.

Suggested fix:
It should either be disabled or it should work. The least that should be is a display of the reason why it does not work!

I understand that maybe the logic is that you shouldn't be able to twittle with your primary key and foreign keys (I noticed that you can change the order of a normal index), but this is a modeling tool. Obviously, since the user (me) is trying to change it, it needs to be changed. Since the order changing does not work I need to go to the foreign keys index tab and remove all fields from my key and then add them again in the right order... (Or go to the columns tab and remove the primaries and add them again...)
[9 Jun 2008 10:03] Johannes Taxacher
verified in 5.0.22
[15 Apr 2009 17:06] David Finch
Is there a workaround for this, apart from remembering to manually fix the bad ordering in the exported SQL later on (which could be called a workaround for almost every workbench bug ever)? I use compound primary keys to control sorting of records, to group them by their parent record's id.
[15 Apr 2009 19:11] David Finch
I found my own workaround, which I'll share. Open the .mwb file as a zip file and extract the document.mwb.xml from it. Then open the xml and find object for the table, to get the primaryKey guid. Then search for the primary key's object and rearrange the IndexColumn values within it, and copy the modified xml back to the .mwb zip file.
[30 Jun 2009 18:58] Johannes Taxacher
fixed in 5.1 now. fix will be included in 5.1.16
[1 Jul 2009 10:28] Tony Bedford
An entry was added to the 5.1.16 changelog:

In the Indexes tab of the Table Editor, it was not possible to change the order number of a column for an index of type PRIMARY in the Index Columns panel, using the drop down list box available in the # column.