Bug #74439 Workbench: SQL Editor shows error, when there aren't any in a query
Submitted: 18 Oct 2014 20:43 Modified: 11 Nov 2014 11:30
Reporter: Kartar Saxena Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:6.2.3.12312 build 2280 (32-bit) OS:Any
Assigned to: CPU Architecture:Any

[18 Oct 2014 20:43] Kartar Saxena
Description:
I wrote the following query in the SQL Editor and it shows a cross against it highlighting that there's a syntax error:

SELECT Queue, if(locate('?', current_page) > 0, left(current_page, locate('?', current_page) - 1), current_page) as `page`, count(*) as count FROM Airtel_AES_Logs.tmp_access_daily
group by Queue, `page`;

However, the query executes fine. The error checker has some issues.

How to repeat:
Happens everytime I run MySQL Workbench

Suggested fix:
The Workbench SQL Editor syntax checker needs to be fixed
[19 Oct 2014 1:41] MySQL Verification Team
Thank you for the bug report. Please provide the exactly version 6.2.X and a screen-shot of the issue. Thanks.
[20 Oct 2014 10:32] Kartar Saxena
Miguel - I've uploaded 3 screen-shots to help address your request. HTH!
[20 Oct 2014 12:36] MySQL Verification Team
Thank you for the feedback.
Verified as described.

From mysql> CLI:

mysql> SELECT LEFT('foobarbar', locate('a', 'foobarbar')-1);
+-----------------------------------------------+
| LEFT('foobarbar', locate('a', 'foobarbar')-1) |
+-----------------------------------------------+
| foob                                          |
+-----------------------------------------------+
1 row in set (0.00 sec)

Valid SQL but SQL Editor shows syntax error in editor:

SELECT LEFT('foobarbar', locate('a', 'foobarbar')-1);
[31 Oct 2014 21:42] Johannes Taxacher
Posted by developer:
 
fix confirmed in 6.2.4. both queries mentioned in the bug are now displayed as valid in SQL editor
[5 Nov 2014 1:59] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 6.2.4 release, and here's the changelog entry:

Inserting the locate() function inside another function would incorrectly
report an SQL syntax error.

Thank you for the bug report.
[11 Nov 2014 11:30] Kartar Saxena
Thanks guys for the fix!

Can I request to be notified once the new version is released? An update to this bug will be just fine as well.

- Kartar
[13 Nov 2014 8:54] MySQL Verification Team
Bug #74834 Marked as duplicate of this one.