Bug #32687 Synchronize on an InnoDB table containing records and an auto_increment column
Submitted: 23 Nov 2007 22:15 Modified: 3 Nov 2009 19:23
Reporter: Graham Nott Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S4 (Feature request)
Version:5.0.9 SE Beta OS:Windows (XP Pro SP2)
Assigned to: Johannes Taxacher CPU Architecture:Any
Tags: auto_increment, innodb, synchronize

[23 Nov 2007 22:15] Graham Nott
Description:
Synchronize with an InnoDB table that already contains records adds an incomplete 'Auto_Increment = ' statement clause to the SQL, when an Auto Increment value for the table has not been defined in Workbench. 

Synchronize with table that contains no records does not include an incomplete SQL clause.

How to repeat:
1. Run the following SQL
   use test;
   create table ai (id int primary key auto_increment) Engine = InnoDB;
   insert into ai values (1);
2. Open Workbench
3. Rename the database as 'test'.
4. Add a table named 'ai', and set its Engine to 'InnoDB'.
5. Add the column named 'id' as int, primary key, auto_increment.
6. Save the Workbench file (maybe not required).
7. Go to Database->Synchronize, connect, and choose the 'test' database.
8. Click next until you reach the SQL Sync Script screen. It will contain:
   ALTER TABLE `test`.`ai` AUTO_INCREMENT =  ;
9. Click next, and Workbench will report "An error has occurred."

Suggested fix:
If there is no value for Auto Increment in the Options tab for an InnoDB table, do not include the 'AUTO_INCREMENT = ' in the SQL statement.
[26 Nov 2007 14:21] MySQL Verification Team
Thank you for the bug report.
[28 Nov 2007 18:18] Vladimir Kolesnikov
AUTO_INC sync was disabled as currently it's not always possible to process it correctly. To be improved later.
[29 Nov 2007 16:31] Johannes Taxacher
fixed to create valid SQL (deactivated AI-synchronisation).

changed i into feature request to be improved later.