Bug #84697 Schema inspector sorting can cause the drop table to be dropped/truncated
Submitted: 27 Jan 2017 20:32 Modified: 2 Feb 2017 2:00
Reporter: Richard E Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:6.3.8 OS:Ubuntu (16.10)
Assigned to: CPU Architecture:Any

[27 Jan 2017 20:32] Richard E
Description:
Sorting tables in the schema migrator will update the UI, but doesn't seem to update the underlying data. For example, if I had two tables (A and B), they will initially be sorted alphabetically, if I then sort the tables in reverse by name, they will be listed as B then A. If I then right click on B, and choose "DROP Table", the resulting sql will instead be for table "A" instead of "B".

Downstream bug: https://bugs.launchpad.net/ubuntu/+source/mysql-workbench/+bug/1599956

How to repeat:
Steps to reproduce:
1. Create a database with two tables. (eg, table_a, table_b)
2. In mysql-workbench, open the connection to the database.
3. Right click on the schema, and click "Schema Inspector".
4. Select the "Tables" tab.
5. Click the "Name" column twice to reverse the sort order.
6. Right click the top table (should be `table_b`), and select "DROP Table"

In the alert box that pops up, it says that it will drop table_a, not the selected table_b.
This bug also happens with the TRUNCATE command.

Suggested fix:
The UI should match what is going on under the hood.
[27 Jan 2017 22:12] MySQL Verification Team
Drop dialog

Attachment: delete_b_not_a.png (image/png, text), 174.22 KiB.

[27 Jan 2017 22:14] MySQL Verification Team
Thank you for the bug report. Not repeatable on Windows.
[2 Feb 2017 2:00] Christine Cole
Fixed as of the upcoming MySQL Workbench 6.3.9 release, and here's the changelog entry:

Objects sorted in the schema inspector and then selected for an operation,
such as Drop Table, generated a statement for the wrong object.

Thank you for the bug report.