Bug #66505 Semicolon at the end of a comment acts like a statement delimiter
Submitted: 22 Aug 2012 20:11 Modified: 6 Sep 2012 16:02
Reporter: David Berg Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.42 OS:Any (Windows, Mac OS X)
Assigned to: CPU Architecture:Any
Tags: regression

[22 Aug 2012 20:11] David Berg
Description:
This is similar to Bug 65230, which has been suspended.

This bug seems to have been introduced between versions 5.2.39 and 5.2.42.

A semicolon at the end of a comment is treated as a statement delimiter and causes a parsing error by ignoring everything that follows it.

E.g. 
CREATE TABLE tab1  -- Comment;
(col1 INTEGER,
 col2 INTEGER
);

... produces the error "A table must have at least one column."

This may be related to a change that in previous versions, the statement on the cursor line is the one executed, no matter where on that line the cursor is positioned. Now, the statement on the cursor line is executed only when the cursor is in front of the semicolon. (Why?)

How to repeat:
Open MySQL Workbench 5.2.42 to the SQL Editor.
Type the following and execute it (with the cursor on the first line):

CREATE TABLE tab1  -- Comment;
(col1 INTEGER,
 col2 INTEGER
);

Type the following and execute it (with the cursor on the first line):

SELECT col1, col2 -- FROM Tab1;
FROM Tab2;

In both cases, parsing errors occur. Everything following the comment is ignored.

Suggested fix:
Restore previous functionality. Don't treat a semicolon at the end of a comment as a statement delimiter.
[23 Aug 2012 6:09] Valeriy Kravchuk
Thank you for the bug report. Verified on Mac OS X also.
[6 Sep 2012 16:02] Philip Olson
Fixed as of the upcoming Workbench 5.2.43, and here's the changelog entry:

 A semicolon at the end of a single lined SQL comment would be
 treated as a delimiter, and cause the SQL query to not execute. 

Thank you for the report.