Bug #77910 Invalid syntax COMMENT '' in CREATE TABLE
Submitted: 2 Aug 2015 23:36 Modified: 3 Aug 2015 4:41
Reporter: Matt Searles Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:6.3.4 OS:Windows (Microsoft Windows 7 Professional Service Pack 1)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[2 Aug 2015 23:36] Matt Searles
Description:
Workbench is generating invalid CREATE TABLE syntax.

...
08:41:29 [INF][      Workbench]: UI is up
08:41:30 [INF][      Workbench]: Running the application
08:42:35 [INF][ Canvas backend]: Found OpenGL version for this view: 4.2.12217 Compatibility Profile Context 12.104.0.0
08:55:56 [WRN][  TableEditorBE]: ENUM() is not a valid column typeFetching schema list.	
09:14:24 [INF][            grt]: OK	
09:14:54 [INF][            grt]: Executing SQL script in server	
09:14:55 [ERR][            grt]: 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 'COMMENT '')
ENGINE = InnoDB' at line 15
SQL Code:
        -- -----------------------------------------------------
        -- Table `CmeRwc`.`Users`
        -- -----------------------------------------------------
        CREATE TABLE IF NOT EXISTS `CmeRwc`.`Users` (
          `UserId` INT NOT NULL AUTO_INCREMENT COMMENT '',
          `Username` VARCHAR(15) NOT NULL COMMENT '',
          `Password` VARCHAR(127) NOT NULL COMMENT '',
          `Email` VARCHAR(255) NOT NULL COMMENT '',
          `IsAdmin` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '',
          `Points` INT NOT NULL DEFAULT 0 COMMENT '',
          `CreatedAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
          `ModifiedOn` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
          `FirstName` VARCHAR(32) NULL COMMENT '',
          `Lastname` VARCHAR(32) NULL COMMENT '',
          PRIMARY KEY (`UserId`)  COMMENT '')
        ENGINE = InnoDB
	
09:14:55 [INF][            grt]: SQL script execution finished: statements: 5 succeeded, 1 failed
	
09:14:55 [INF][            grt]: Fetching back view definitions in final form.	
09:14:57 [INF][            grt]: Nothing to fetch	
09:20:31 [INF][            grt]: Fetching schema list.	
09:20:33 [INF][            grt]: OK
...

How to repeat:
1) Create new model
2) Add tables, fields, foreign keys
3) Hit Forward Engineer or Synchronize Model

Suggested fix:
Default COMMENT to NULL not empty string
[2 Aug 2015 23:42] Matt Searles
Apologies, it seems its this line

PRIMARY KEY (`UserId`) COMMENT ''

which is the problem, not the empty string.
[2 Aug 2015 23:42] Matt Searles
Apologies, it seems its this line

PRIMARY KEY (`UserId`) COMMENT ''

which is the problem, not the empty string.
[3 Aug 2015 4:18] MySQL Verification Team
Hello Matt,

Thank you for the report.
I could not repeat this issue with dummy model, could you please provide repeatable WB model file(you may want to mark it as private) to confirm this issue ta our end?

Thanks,
Umesh
[3 Aug 2015 4:38] MySQL Verification Team
Thank you for the model file.
I'm not seeing this issue when forward engineering to MySQL 5.6.25 instance. 
This issue is observed when you are forward engineering to < 5.5.3 instance and even with Default Target MySQL version in Preferences is set to 5.1.
This is most likely caused because as of MySQL 5.5.3, index definitions can include an optional comment and this seems to be causing issue here.
[3 Aug 2015 4:41] Matt Searles
Thanks Umesh. Is there a work-around for this issue?
[15 Sep 2015 10:48] Den Parygin
When the solution for this problem?
[15 Sep 2015 10:49] Den Parygin
When the solution for this problem?
OS: Mac OS X 10.10.5
[22 Sep 2015 4:11] MySQL Verification Team
Bug #78505 marked as duplicate of this
[9 Oct 2015 7:57] Matthias Vogt
This is an extremely annoying bug.
Can you please tell something about release date of the bugfix?

Thanks so far!
Matthias