Bug #85568 Copying a CREATE TABLE Statement from an EER Diagrm Truncates Table Comment
Submitted: 21 Mar 2017 13:27 Modified: 18 May 2018 20:45
Reporter: Jason Franklin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:6.3.9 OS:Windows (Windows 10 Enterprise, v1607)
Assigned to: CPU Architecture:Any
Tags: comment, CREATE TABLE, workbench

[21 Mar 2017 13:27] Jason Franklin
Description:
A previous bug report (Bug #62207) showed that exporting a table from MySQL Workbench with a longer comment would result in a truncated comment.  This was a carry over from the fact that table COMMENT fields used to be far more limited in length.  However, the limit is now 2048 bytes.

A related feature was not fixed when this bug was addressed, and the problem remains in version 6.3.9 of Workbench.

How to repeat:
1. Create a table with a long table COMMENT field in a Workbench EER diagram.
2. Right click the table and select "Copy SQL to Clipboard" from the context menu.
3. Paste the SQL into the SQL Editor and notice that the table COMMENT is partially commented out after ~60 chars.

If you wish, use the menu bar to export the model to an SQL script using:  "File | Export | Forward Engineer SQL Create Script...".

This will show that the COMMENT field is not truncated.  Thus, the feature works when exporting the model, but behaves incorrectly when using the model to edit the related, auto-generated SQL code.

Suggested fix:
Whatever limit controls the automatic commenting in MySQL Workbench should be extended to 2048 characters.

Thank you for your time!
[21 Mar 2017 18:47] MySQL Verification Team
Thank you for the bug report. Please provide a model file as test case, attach it using the Files tab. Thanks.
[21 Mar 2017 19:06] Jason Franklin
Example model for bug demonstration.

Attachment: example_model.mwb (application/octet-stream, text), 5.47 KiB.

[21 Mar 2017 19:08] Jason Franklin
The requested file has been added.

Note that you may choose "Copy SQL to Clipboard" from the EER Diagram context menu or from the main model tab context menu.  Pasting to an SQL editor from these locations will result in part of the table comment being commented out unnecessarily.
[21 Mar 2017 19:12] Jason Franklin
NOTE:  This same problem does seem to affect column comments as well as table comments. I just noticed this and wanted to pass it along.
[21 Mar 2017 19:44] MySQL Verification Team
Long comment

Attachment: long_comment.png (image/png, text), 98.10 KiB.

[21 Mar 2017 19:47] MySQL Verification Team
Thank you for the feedback. I followed your instructions and using the wordpad Windows application pasted the clipboard without truncation. Wonder if your SQL Editor is the issue (please see prior attached screenshot). Thanks.
[21 Mar 2017 19:51] Jason Franklin
Actually, if you look closely at the content you pasted in WordPad you'll notice that the comment was truncated.  It's not apparent since syntax highlighting is not enabled.  Truncation should happen, but it should be at 2048 chars, not at ~60 chars.
[22 Mar 2017 0:57] MySQL Verification Team
Thank you for the feedback. Indeed now I noticed and when using the mysql command client I am able to create a table with such long comment.
[18 May 2018 20:45] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 8.0.12 release, and here's the changelog entry:

Long comments in tables were truncated with too few characters when pasted
into the SQL editor after using Copy SQL to Clipboard from the context
menu within an EER diagram or the MySQL Model tab. This fix extends the
threshold.

Thank you for the bug report.