Bug #51596 Query Editor syntax highlight indicates comment without space after two dashes
Submitted: 1 Mar 2010 4:53 Modified: 21 Apr 2010 14:36
Reporter: Terry Bailey Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.16 rev 5249 OS:Windows (Windows 7)
Assigned to: Sergei Tkachenko CPU Architecture:Any
Tags: --, comment, dash dash, highlight, syntax, two dashes

[1 Mar 2010 4:53] Terry Bailey
Description:
At least in Windows, the syntax highlighting indicates that a comment has been entered when only two dashes exist without the space after.  This could cause some confusion for someone since MySQL will error when it attempts to execute the comment as part of the query.

How to repeat:
Enter the following into the query editor

--This is a comment
select * from test;

"--This is a comment" is highlighted as if it is a comment.  

Executing this query will result in a syntax error as MySQL tries to execute the comment since MySQL requires two dashes and followed by a space to have a valid comment "-- " not "--"

Suggested fix:
Correct the highlighting issue so that comments are only highlighted when the two dashes are followed by a space.
[1 Mar 2010 9:06] Valeriy Kravchuk
Thank you for the bug report. Verified just as described.
[16 Apr 2010 16:14] Johannes Taxacher
this is now detected as error.
fixed in repository
[21 Apr 2010 14:36] Tony Bedford
An entry has been added to the 5.2.19 changelog:

In the SQL Editor, the syntax highlighter coloured two dashes as a comment. This was incorrect, as two dashes should only be highlighted as a comment when followed by a space.