Bug #68945 Renaming a table causes the object tree to misbehave
Submitted: 13 Apr 2013 9:37 Modified: 13 Apr 2013 14:43
Reporter: Teodor Hadjiev Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.47 OS:Microsoft Windows (Win7 x64)
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D4 (Minor)

[13 Apr 2013 9:37] Teodor Hadjiev
Description:
Renaming a table (by right clicking the table in the sql editor object tree then Alter table, then giving a new name - Apply) causes the object tree to misbehave when navigating it.
The Tables node is open during the update (naturally, I right click the table and select Alter table).
After the rename, the tables list in the tree is not updated/sorted to reflect the new name (but the name in the tree changes to the new name). I choose Refresh All for the Tables node. Nothing happens. I then click on the table name (with its new name) and a new table node appears with the same name in the right sorting position, yet the one row I just clicked doesn't disappear. I end up having two items in the Tables node with the same name - my new table name, in the new (sorted) position, and in the original position.

How to repeat:
Rename a table from the object tree in SQL Editor, so that its new name should reposition it in the (sorted) object tree (node Tables).
Try to Refresh All in the Tables.
Click on the table with the new name.
A new table appears with the same (new) name, in the correct sorting position.
The old position doesn't disappear.

Suggested fix:
When something happens with the tables, especially renaming, the object tree should automatically reflect and reposition the objects. Also after a Refresh All operation, it should do a complete redraw of the objects, with resorting etc.
Refresh All is a "start-over" command for the displaying of everything, and the object tree and tables should be freshly redrawn After resetting (clearing/removing) the object nodes completely in the tree.
[13 Apr 2013 14:43] Miguel Solorzano
Thank you for the bug report. Verified as described.
[26 Jul 2015 6:43] Paul Weiss
Basically the same thing is happening for me, in 6.3.4.0 on Microsoft Windows (7 Home Premium SP 1) 64-bit. But it's not quite the same behavior:

After applying a table rename by prefixing "aa" to the old table name, the table's new name shows up in both the new and old sort location. The new location is fine. The old location doesn't show any subtable objects like columns, and show "fetching..." for foreign keys and triggers. As expected, after clicking on refresh, the old location properly disappears.

When I then rename that table changing "aa" to "zz", I get similar behavior, the only difference being no "fetching...". However, when I click refresh, it is the _new_ location that disappears! And the subtable objects do not show up in the schema navigator, although they do show up in the table editor.

After closing and reopening the connection, everything displays properly.