Bug #57280 MySql Workbench produces wrong SQL-Query for a column which alters
Submitted: 6 Oct 2010 11:50 Modified: 7 Oct 2010 17:09
Reporter: Pedram Ganjeh Hadidi Email Updates:
Status: Closed Impact on me:
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.2.28 CE Rev. 6722 OS:Windows (7 - 64Bit)
Assigned to: CPU Architecture:Any
Tags: wrong sql code generation for altered column

[6 Oct 2010 11:50] Pedram Ganjeh Hadidi
MySql-Workbench produces/generates wrong SQL-Code when you change data types (columns) in your tables.

An example: Try to define an ID column BITINT(20), then after committing, refresh, then try to change the ID by adding NOT NULL, AUTO_INCREMENT, UNSIGNED and last but not least PRIMARY KEY. You will fail if you try this by doing it using the GUI. Instead of doing this in GUI, just drop the table, commit, refresh and then create the table by typing the sql-code and then commit, it works!

How to repeat:
1. Open Workbench
2. Select and open your DB
3. create a table
4. add some columns, name the first "id" as BIGINT(20)
5. commit
6. refresh
7. change "id" (by "Alter Table..." in context-menu of the new added table): UNSIGNED, NOT NULL, AUTO_INCREMENT, PRIMARY KEY by using the GUI (click on the checkboxes of named column-properties)
8. try to commit and you will fail. Reason: wrong SQl-code!
[7 Oct 2010 17:09] Johannes Taxacher
this problem is related to the index-creation-failure in version 5.2.28 which has been fixed in repository and will be included in next release.