Bug #74530 Adding comments to an index results in erroneous exported SQL script.
Submitted: 23 Oct 2014 20:46 Modified: 15 Sep 2016 21:58
Reporter: Fotis Kokkoras Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:6.2.3 OS:Windows (Microsoft Windows 7 Professional)
Assigned to: CPU Architecture:Any
Tags: comments, export, INDEX

[23 Oct 2014 20:46] Fotis Kokkoras
Description:
Adding comments to an index results in erroneous exported SQL script.

How to repeat:
1. Create a new EER model.
2. Add table students with two columns, id (int PKey) and surname (varchar)
3. Go to the index tab and add an index of type INDEX over the surname column. 
4. Add some comment text in the Index Comment textbox.
5. Go to File > Export > Forward Engineer SQL Create SCRIPT... and follow the wizard. When the code appears check that there is a COMMENTS part in the index definition but without any text (the text is actually commented out). Here is an example of the erroneous script:

CREATE TABLE IF NOT EXISTS `mydb1`.`Students` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `surname` VARCHAR(45) NOT NULL,
  PRIMARY KEY (`id`),
  INDEX `surname_INDEX` (`surname` ASC)  COMMENT  /* comment truncated */ /*index comment*/)
ENGINE = InnoDB;

the error is that there exists a COMMENT part but it is not followed by the actual comment set by the user. Additionally, you can see that 'comment truncated' text... 

Suggested fix:
the problem is bypassed if the index comment is removed from the design/model or corrected at the final script.
[24 Oct 2014 15:32] MySQL Verification Team
Thank you for the bug report. I couldn't repeat please provide the model project file which provoke this issue. Thanks.
[24 Oct 2014 15:42] Fotis Kokkoras
mwb, exported sql, and issue screenshot

Attachment: index_comment_issue.zip (application/x-zip-compressed, text), 278.08 KiB.

[27 Oct 2014 12:47] MySQL Verification Team
Thank you for the feedback.
[15 Sep 2016 21:58] Christine Cole
Posted by developer:
 
Fixed as of the upcoming Workbench 6.3.8 release, and here's the changelog entry:

Index comments were improperly generated within the index section of an
SQL script when using the Forward Engineer SQL Script wizard to create and
export the script.

Thank you for the bug report.
[15 Sep 2016 21:58] Christine Cole
Posted by developer:
 
Fixed as of the upcoming Workbench 6.3.8 release, and here's the changelog entry:

Index comments were improperly generated within the index section of an
SQL script when using the Forward Engineer SQL Script wizard to create and
export the script.

Thank you for the bug report.
[15 Sep 2016 21:59] Christine Cole
Posted by developer:
 
Fixed as of the upcoming Workbench 6.3.8 release, and here's the changelog entry:

Index comments were improperly generated within the index section of an
SQL script when using the Forward Engineer SQL Script wizard to create and
export the script.

Thank you for the bug report.