Bug #92549 Cannot Alter Table That Contains A Table Comment With Single Quote
Submitted: 24 Sep 2018 18:34 Modified: 25 Sep 2018 11:03
Reporter: Matthew Roberts Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0.12 OS:Microsoft Windows (Microsoft Windows 8.1 Enterprise)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[24 Sep 2018 18:34] Matthew Roberts
Description:
Unable to right click a table and select "Alter Table..." if table contains a TABLE comment containing a single quote.

Error is raised:

[Window Title]
MySQL Workbench

[Main Instruction]
Error Parsing DDL for `SIEM Data Sources`.`TimeZone`

[Content]
There was an error while parsing the DDL retrieved from the server.
Do you want to view the DDL or cancel processing it?

[View DDL] [Cancel]

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 table and select "Alter Table..." error will occur.

Suggested fix:
Handle escaped table and don't error :)

FYI:

mysql> SHOW CREATE TABLE TimeZone;
+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table    | Create Table
                                                                                                                                                               |
+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| TimeZone | 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 AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='The timezone the data source''s clock is set to.' |
+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql>
[24 Sep 2018 18:34] Matthew Roberts
Sorry, forgot to set appropriate severity.
[24 Sep 2018 19:30] Miguel Solorzano
Thank you for the bug report.
[25 Sep 2018 10:04] Mike Lischke
Duplicate of Bug #92191
[25 Sep 2018 11:03] Matthew Roberts
Ah, hadn't searched for CLOSED issues. Agreed this is a duplicate. Apologies!