Bug #63624 Multiple times DELIMITER added after schema name changed
Submitted: 6 Dec 2011 10:48 Modified: 14 Dec 2011 23:18
Reporter: Dennis Minderhoud Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S2 (Serious)
Version:5.2.36 OS:Windows (any)
Assigned to: CPU Architecture:Any
Tags: DELIMITER, routine, schema name change, workbench

[6 Dec 2011 10:48] Dennis Minderhoud
Description:
When I change the name of the schema, the routines stored in the project are changed automaticly.
Every time after a name change there is a 'DELIMITER $$' added at the top of the code of the routine and a '
$$
DELIMITER ;' at the bottom of the code.
When I want to forward engineer this model, this results in an error because the last '$$' is not known, as therefore it was set to ';'.
-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$

DELIMITER $$
CREATE PROCEDURE `schema`.`routine1` ()
BEGIN
 select * from tablename;
END

$$
DELIMITER ;

$$
DELIMITER ;

How to repeat:
make a model with a routine.
change the model name (and apply with the thunder icon)
save the model
open the routine in the sql editor and see the result.

Suggested fix:
do not apply an extra 'DELIMITER $$' and '$$ \r\n DELIMITER;' when they already exist in the routine
[6 Dec 2011 11:15] Valeriy Kravchuk
Thank you for the bug report. Verified just as described on Windows XP.
[14 Dec 2011 23:18] Philip Olson
Fixed as of 5.2.37:

Changing a schema name with routines present would prepend and
append invalid delimiters.