Bug #54319 Synchronize Model generates 'AUTO_INCREMENT = ;'
Submitted: 8 Jun 2010 4:16 Modified: 16 Jun 2010 16:29
Reporter: Dragon Chuang Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.2.22 OS:Windows (7)
Assigned to: Alexander Musienko CPU Architecture:Any

[8 Jun 2010 4:16] Dragon Chuang
Description:
If a table contains an auto_increment column and inserted any row into the table,
Synchronize Model will generates 'ALTER TABLE `mydb`.`table1` AUTO_INCREMENT =  ;'

MySQL Workbench version : 5.2.22
MySQL Server version : 5.1.47

How to repeat:
1. File / New Model
2. Add 'table1'
3. Add 'column1' datatype INT and check PK, NN, UN, AI
4. Add 'column2' datatype VARCHAR(45)
5. Database / Forward Engineer
6. [Next] , [Next] , [Next] , choice Stored Connection, Execute, [Close]
7. INSERT row to 'table1':

mysql> INSERT INTO `mydb`.`table1` (`column2`) values ('bug test');

8. Database / Synchronize Model
9. choice Stored Connection, [Next], [Next]
10. 'Select the Schemata to be Processed', [Next], [Next]
11. 'Model and Database Differences' show 'table1 --> table1', [Next]
12. 'Preview Database Changes to be Applied':

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

ALTER TABLE `mydb`.`table1` AUTO_INCREMENT =  ;

SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

13. [Execute], got error:

Executing SQL script in server
ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

ALTER TABLE `mydb`.`table1` AUTO_INCREMENT =  

SQL script execution finished: statements: 3 succeeded, 1 failed
[10 Jun 2010 16:59] Robert Cesaric
Confirming that I'm having the same issue on WB version 5.2.22.
[14 Jun 2010 21:43] Johannes Taxacher
Bug #54289 has been marked as duplicate of this one
[16 Jun 2010 14:16] Johannes Taxacher
fix confirmed in repository.

this param is only honored in forward engineering from now on. It doesn't make much sense to keep syncing a parameter that sets an "initial" value.
[16 Jun 2010 16:29] Tony Bedford
An entry has been added to the 5.2.23 changelog:

On synchronizing a model with a live database incorrect SQL code was generated:

ALTER TABLE `mydb`.`table1` AUTO_INCREMENT =  ;
[18 Jun 2010 7:55] Mike Lischke
Bug #54507 was marked as a duplicate of this reprot.