Bug #75564 Parser shows incorrect error
Submitted: 20 Jan 2015 14:48 Modified: 21 Jan 2015 10:24
Reporter: Aram Mirzadeh Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:6.2.3.12312 OS:Any
Assigned to: CPU Architecture:Any

[20 Jan 2015 14:48] Aram Mirzadeh
Description:
Incorrect parsing of string math function within select.
Tried it on Windows 8 and Mac OS X v6.2.3.12312

How to repeat:

In a UDF I have the following test, which runs fine from command line (MySQL v5.6.14)

	IF test > 0 THEN
		SELECT MAX(RIGHT(`id`,LENGTH(`id`)-LOCATE('-',prefix)))+1 
		INTO count 
		FROM 
			`assessment` 
		WHERE 
			`id` LIKE aId;
	END IF;

However Workbench SQL Editor shows for: 

LENGTH: Syntax error: 'LENGTH' (identifier) is not valid input at this position
`id`: Syntax error: `id` (back tick quoted id)
END: Syntax error: missing 'semicolon'

Suggested fix:
This is a valid sql statement and should not be shown as error in the editor.
[21 Jan 2015 5:11] MySQL Verification Team
Thank you for the report.
I could not see this issue with latest WB 6.2.4 version(checked on Win7, OL6 etc). Could you please try GA release of Workbench 6.2.4? If you see the issue then pls provide the screenshot of the same.

// Tried below dummy SP without any issue

delimiter //
CREATE PROCEDURE simpleproc()
 BEGIN
 declare test int;
 declare count int;
 set test:=1;

	IF test > 0 THEN
		SELECT MAX(RIGHT(`id`,LENGTH(`id`)-LOCATE('-',prefix)))+1 
		INTO count 
		FROM 
			`assessment` 
		WHERE 
			`id` LIKE aId;
	END IF;

 END//
delimiter ;
[21 Jan 2015 10:24] Aram Mirzadeh
You're right 6.2.4 does parse the string correctly. Now I have another bug for 6.2.3 ... the in-app "Check for Updates" is also broken; I checked it to see if there was an update and it reported that it was the latest version.

Thanks.