Bug #92550 Syntax Parser Errors With Valid Table Comment
Submitted: 24 Sep 2018 18:49 Modified: 25 Sep 2018 11:00
Reporter: Matthew Roberts Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:8.0.12 OS:Windows (Microsoft Windows 8.1 Enterprise)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[24 Sep 2018 18:49] Matthew Roberts
Description:
Sending an existing table's create statement to the SQL editor causes the query editor to show an error:

's clock is set to.' is not valid at this position, expecting: EOF, ';'

However actually executing the statement against the server is successful.

How to repeat:
CREATE TABLE `TimeZone` (
 `TimeZoneID` TINYINT     UNSIGNED             NOT NULL AUTO_INCREMENT,
 `TimeZone`   VARCHAR(29) CHARACTER SET LATIN1 NOT NULL,
  UNIQUE INDEX `TimeZone_TimeZone` (`TimeZone`),
 PRIMARY KEY (`TimeZoneID`)
) COMMENT = 'The timezone the data source\'s clock is set to.';

Then right click the table and select "Send to SQL Editor"->"Create Statement".

The SQL editor will display :

CREATE TABLE `TimeZone` (
  `TimeZoneID` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
  `TimeZone` varchar(29) CHARACTER SET latin1 NOT NULL,
  PRIMARY KEY (`TimeZoneID`),
  UNIQUE KEY `TimeZone_TimeZone` (`TimeZone`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='The timezone the data source''s clock is set to.';

Note the table comment has changed to double quotes (presumably an alias for escaping). The query editor will now state this syntax is invalid. If you ignore it and execute the statement anyway it succeeds.

Suggested fix:
Update syntax parser to allow this form of escaping or change the way server expresses create statements to not use this notation (although might have issues for users with NO_BACKSLASH_ESCAPES set).

FYI:

SHOW VARIABLES LIKE 'version';

'version', '5.7.23-log'
[25 Sep 2018 5:05] MySQL Verification Team
Hello Matthew,

Thank you for the report!
Observed this on Win7 with WB 8.0.12.

regards,
Umesh
[25 Sep 2018 10:00] Mike Lischke
Duplicate of Bug #92191
[25 Sep 2018 11:00] Matthew Roberts
Referenced duplicate is explicitly for ALTER TABLE, this is for Syntax Parser Errors.. can you please confirm both are fixed :)?