Bug #79779 Non compliant SQL for synchronization
Submitted: 26 Dec 2015 0:33 Modified: 18 Jan 2016 12:51
Reporter: Single Use Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S2 (Serious)
Version:6.3.4, 6.3.6 OS:Microsoft Windows (Microsoft Windows 7 Home Premium Service Pack 1)
Assigned to:
Tags: SQL, SQL Generation, synchronize, WBBugReporter, workbench

[26 Dec 2015 0:33] Single Use
Description:
SQL file generated by Workbench when "Synchronize with other source..." has wrong syntax.

$ mysql -u user < alter-1.sql
ERROR 1064 (42000) at line 12: 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 'AFTER `author`,
ADD COLUMN `filename` VARCHAR(512) NULL DEFAULT NULL COMMENT    ' at line 2

The content of SQL file, that causes a mistake:

ALTER TABLE `construction`.`media` 
ADD COLUMN `data` BLOB NULL DEFAULT NULL COMMENT  /* comment truncated */ /*Data itself. if not in here - check filename*/ AFTER `author`,
ADD COLUMN `filename` VARCHAR(512) NULL DEFAULT NULL COMMENT  /* comment truncated */ /*If data not in DATA, then here is a filename where data stored (or URL)*/ AFTER `data`,
ADD COLUMN `private` TINYINT(4) NULL DEFAULT 0 COMMENT  /* comment truncated */ /*0 - not private
1 - private, solely for author's use*/ AFTER `replaces`;

According to the documentation, comments should be included in '', not in /* */

How to repeat:
Create a model with a table with more than 1 column, export it to SQL file, then add a column with a comment.

In Workbench menu DATABASE, go to "Synchronize with other source...", select Model Schemata as a source, previously exported SQL as a destination, and Alter script file.

Complete update procedure and check the Alter script file - it will have column comments between /* */ instead of ''.
[18 Jan 2016 12:51] Umesh Shastry
Hello!

Thank you for the report and steps.
Verified as described with WB 6.3.6 on Win7.

Thanks,
Umesh