Bug #51886 Comment editor loads comments offset by one character
Submitted: 9 Mar 2010 19:34 Modified: 16 Apr 2010 15:26
Reporter: Ed Eaglehouse Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.16 OSS OS:Microsoft Windows (Vista 32-bit)
Assigned to: CPU Architecture:Any
Tags: alter, comment, editor, SQL, table

[9 Mar 2010 19:34] Ed Eaglehouse
Alter table command in SQL Editor loads table and field comments incorrectly. Editor includes quote preceding comment text and removes last character of comment text. If not edited, Apply attempts to replace the comment with the mangled version.

This happens for both table comments and field comments.

How to repeat:
1. Create a new table or alter an existing one.
2. Add a comment, e.g. "Contains summary information".
3. Apply the change and close the editor window.
4. Alter the table.
5. Comments field contains comment preceded by single quote and missing last character. E.g. "'Contains summary informatio".
6. Apply the change. See in the Apply SQL Script to Database confirmation window that the comment being applied is the mangled one.

Minor difference between table comment and field comment when applying without editing the comment: the initial quote in the table comment is not escaped; for a field, it is. E.g. "... COMMENT = ''Table descriptio'" vs. "... COMMENT = '\'Field descriptio'".

Suggested fix:
Behavior implies that comment loading is taking a substring of the SQL COMMENT = '...' attribute and extracting the text starting with a position 1 character short of where the comment actually begins. Length appears correct. Fix would be to increase the starting index by 1 when loading a comment for editing.

Saving appears to behave as expected, with the exception of not escaping the single quote for a table comment. I do not know if this is the intended behavior.
[10 Mar 2010 4:18] Valeriy Kravchuk
Looks like a duplicate of Bug #51765. Please, check.
[10 Apr 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[12 Apr 2010 14:16] Ed Eaglehouse
With the condition that this affects both table and field comments, I agree this does looks like a duplicate of http://bugs.mysql.com/bug.php?id=51765.
[16 Apr 2010 15:26] Valeriy Kravchuk
Duplicate of bug #51765.