Bug #53749 Reordering columns doesn't work properly
Submitted: 18 May 2010 12:55 Modified: 29 Jun 2010 13:11
Reporter: Marian Boda Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.21 OS:Windows (Win 7)
Assigned to: Mike Lischke CPU Architecture:Any
Tags: column, reordering

[18 May 2010 12:55] Marian Boda
Description:
There are several bugs involved in reordering columns in tables

1. If i drag a column, and try to drop it between another two, it end up under bottom one (of the two), not between them. if i have columns a,b,c, i try to drop a between b and c, i should get sequence b,a,c, but i get b,c,a. It even depends on direction of moving - different behavior for moving down, and for moving up.

2. if i make a slow double click it will open textfield for column rename. But if you drag that column shortly after second click (just before the text field shows up), it also opens textfield, and when you drop it somewhere else, that open textfield will stay in it's original position, and if you click outside or press enter, you will rename another column than you originally clicked and dragged, so you will have two columns with the same name.

3. from previous problem it's obvious it allows two (and more) columns with the same name.

4. with multiple columns selected (adjacent), trying to drag and drop them somewhere, it messes up the order of many columns. I tried to move 5 columns, it moved only 3 of them and shuffled at least two other columns. Moving more columns makes mess almost every time when i try it.

How to repeat:
1. make new table, columns id, a, b, c, and with reordering them by dragging and dropping, it doesn't work how it's supposed to.

2. double click on a table column in columns tab, and drag it right after it, so you drag it before the rename textfield shows up. Than drop that column somewhere else, and click outside of textfield or press enter. That rename textfield will rename different column than you clicked.

3. create column 'a', confirm, and then create more columns with the name 'a'.

4. create new table, columns id,a,b,c,d,e,f, select columns a,b,c,d, and drag and drop them between e and f. I got this sequence: id,b,d,f,c,e,a, and columns b,d,f,c were selected after that (same positions as originally selected columns)

Suggested fix:
1. It looks like you have serious mess in that columns list. You should have separate methods for removing element (or sequence of elements) from list, and for adding element (s) into the list, so if you have these methods and tested they work right, this drag'n'drop should be easy.

2. don't allow showing up rename textfield after the field is being dragged.

3. check column names on rename/create, so there wouldn't be multiple columns with the same name.

4. Fixing number one should make it work.

(I have one more suggestion: you may consider making reordering possible with ctrl+arrows).
[18 May 2010 16:30] Valeriy Kravchuk
Can you, please, upload .mwb file and exact instructions what columns to move. I've tried with my models on XP and I can not repeat problems 1 and 4. For me column reordering just works...
[18 May 2010 23:13] Marian Boda
Ok, here is what exactly i do:
1. open mysql workbench (no install version)
2. click on Create new EER Model
3. Add Diagram
4. create new table
5. double click, and go to Columns tab
6. i leave first column as is, and add 3 columns: a,b,c

Now here is the thing: i drag column a, and when i move (without dropping) it between column b and c, a bold line appears to show where it will be dropped - between b and c. And now, if you drop it there, but with mouse cursor a little above the bold line (while still that line between b and c is visible), all works well, but if you drop it under that line (while of course line still shows position between b and c), than a will end up after column c. It looks like just that line appearing is misguiding, and without it showing it may work ok. This happens on my Win7 machine as well as on WinXP laptop.

But Problem with many columns selected and trying to drag and drop it elsewhere appears as well on my WinXP machine. Simple scenario:

1. New model, new diagram, new table
2. Columns: a,b,c,d
3. Select a,b with shift
4. drag it over column c and drop

I expect sequence c,a,b,d, even sequence c,d,a,b would make sense as i move first two columns to position 3, so c and d become first and second.
But i get sequence b,a,d,c - everytime, on win7 and winXP.

if i drop it on column d, sequence is: b,d,a,c.

I just tried it in older version 5.1.16, and this multicolumn bug is doing the very same thing. I use no-install versions only.
[19 May 2010 5:25] Susanne Ebrecht
Many thanks for writing a bug report.

Verified as described.

When you try to put a value from top between two columns then it end up at the end.

a,b,c ... try to get b,a,c ... you will get b,c,a,

When you try from buttom:
a,b,c ... try to get a,c,b ... this works as expected
[19 May 2010 8:33] Marian Boda
@Susanne >> I found out it doesn't depend on if you drag it from up down or the other way, but it depends on which side of the line (which appears between two columns when you drag column over) you drop it. I described it more in my second comment.
[24 May 2010 20:58] Alfredo Kojima
It works as expected here. The only case that could be a little confusing is if you drop it directly on top of an item, instead of above or below an item.
[24 May 2010 21:46] Marian Boda
@Alfredo Kojima >> If you read only my bug report and not a comment i left later, maybe you should look at that. I found out that problem behave a little differently than i reported in original bug report.
[4 Jun 2010 18:29] Jesse Castleberry
Having a similar problem.  I can easily move a column to a new location, but when I try to click the Apply button, I get the message, "No changes to object were detected."
[4 Jun 2010 18:29] Jesse Castleberry
Having a similar problem.  I can easily move a column to a new location, but when I try to click the Apply button, I get the message, "No changes to object were detected."
[15 Jun 2010 15:11] Mike Lischke
Fixed in repository.
[17 Jun 2010 8:45] Mike Lischke
Additional fix added for remaining issue regarding concurrent drag and edit operations.
[18 Jun 2010 13:30] Mike Lischke
Additional fix to maintain order of nodes when dragging multiple nodes.
[25 Jun 2010 13:16] Alfredo Kojima
Fix confirmed in repository
[29 Jun 2010 13:11] Tony Bedford
An entry has been added to the 5.2.25 changelog:

In the Columns tab of the Table Editor, the handling of column ordering appeared to have numerous problems. For example, dragging and dropping a column did not locate the column as expected.