Bug #81932 CASE WHEN syntax not accepted
Submitted: 20 Jun 2016 11:46 Modified: 20 Jan 2017 21:05
Reporter: Lars Kristensen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:6.3.7 OS:Windows (10)
Assigned to: CPU Architecture:Any
Tags: 6.3.7, case when, regression, workbench

[20 Jun 2016 11:46] Lars Kristensen
Description:
Only tested against a 5.7.13 Server.

When creating a new stored procedure either in the SQL editor or in a model. MySQL Workbench reports a syntax error when using the "CASE WHEN" syntax described in documentation:
https://dev.mysql.com/doc/refman/5.7/en/case.html

Opening an already existing procedure containing the syntax fails with error:
"Error Parsing DDL for `DB`.`ProcName`
Then I can choose to View DDL or Cancel.

6.3.6 had no issues with this syntax and many before that. 6.3.7 is pretty useless with this bug

How to repeat:
It may or may not make a difference that default target mysql version is set to 5.7.13

Create the following stored procedure either via SQL editor directly on the server or as a procedure in a model:

CREATE PROCEDURE `new_procedure` ( IN x INT, IN y INT)
BEGIN

CASE
  WHEN x=5 THEN SELECT 'x5';
  WHEN y=7 THEN SELECT 'y7';
  ELSE BEGIN END;
END CASE;

END
[20 Jun 2016 12:08] Lars Kristensen
Btw. Suggested procedure executes just fine on the server once it has been created.

CALL new_procedure(5,7); 
returns x5

CALL new_procedure(6,7);
returns y7

CALL new_procedure(6,8);
returns nothing as expected
[20 Jun 2016 12:16] MySQL Verification Team
Hello Lars Kirulf,

Thank you for the report and test case.
Observed this issue on Win7 with WB 6.3.7.

Thanks,
Umesh
[20 Jun 2016 12:18] MySQL Verification Team
6.3.7 Screenshot

Attachment: 81932_6.3.7.png (image/png, text), 61.53 KiB.

[20 Jun 2016 12:19] MySQL Verification Team
6.3.6 Screenshot

Attachment: 81932_6.3.6.png (image/png, text), 58.31 KiB.

[8 Dec 2016 10:38] Lars Kristensen
Appears to be fixed in version 6.3.8
[20 Jan 2017 21:05] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 6.3.9 release, and here's the changelog entry:

Stored procedures containing valid CASE statements reported syntax errors
when created or edited.

Thank you for the bug report.