Bug #56784 MySQL Workbench - delimiter problem synchronizing prozedures
Submitted: 15 Sep 2010 7:39 Modified: 20 Dec 2010 9:02
Reporter: Michael Kakuschky Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S2 (Serious)
Version:5.2.27 OS:Windows (WIndows 7 x64)
Assigned to: Assigned Account CPU Architecture:Any
Tags: synchronize procedure delimiter problem

[15 Sep 2010 7:39] Michael Kakuschky
Description:
While synchronizing the designed database model with the database MySQL Workbench is creating a SQL to execute the necessary task. To execute CREATE PROCEDURE statements there are "DELIMITER $$" statements inserted to enable execution of CREATE PROCEDURE statements containing the default delimiter ";". After each CREATE PROCEDURE statement the delimiter is set back to the default one. Sometimes after setting the delimiter back to the default one there comes a single "$$" which is not recognize as delimiter, and even makes no sense at this places and the script fails. Copy the script to the clipboard, removing the wrong "$$" and excuting the script manually is a workaround but one of the most important MySQL Workbench features is lost. 

I have the problem by synchronizing my test database (windows 7 64bit) and also with the production system (ubuntu 64bit)

Could the reason be that I migrate from 5.1 to 5.2 and some data ist corrupted?

Here comes a snipset from the code generated by the MySQL Workbench. Take a 
look to the 

DELIMITER ;

$$  

DELIMITER ;

blocks. That are the ones avoiding the script execution.
 
USE `testdb`;
DROP procedure IF EXISTS `testdb`.`proc_a`;

DELIMITER $$
USE `testdb`$$
DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_a`()
BEGIN

  -- snipped content of the procedure ...

END 
$$
DELIMITER ;

$$  

DELIMITER ;
USE `testdb`;
DROP procedure IF EXISTS `testdb`.`proc_b`;

DELIMITER $$
USE `testdb`$$
DELIMITER $$

CREATE PROCEDURE `testdb`.`proc_b`()
begin
	-- snipped content of the procedure ...
end
$$
DELIMITER ;

$$

DELIMITER ;

How to repeat:
Create some procedures and synchronize them with a database

Suggested fix:
Check why wrong and unneccessary delimiters are inserted
[15 Sep 2010 7:48] Michael Kakuschky
Found that there is a similar problem described in Bug #54836. Since it's open for 54 days is there a chance that it will be fixed?
[15 Sep 2010 8:29] Valeriy Kravchuk
Please, upload minimal/any .mwb file that demonstrates the problem.
[15 Sep 2010 9:00] Valeriy Kravchuk
You can upload file as private, and it will be visible only to MySQL developers.
[15 Sep 2010 12:23] Valeriy Kravchuk
Verified while synchronizing your model to MySQL server 5.1.50 on Windows XP. Indeed, the following code is generated:

...
DELIMITER ;

$$

DELIMITER ;
DELIMITER $$
...

P.S. Your .mwb file is visible only to selected Sun and Oracle employees, but not to community members.
[26 Nov 2010 16:55] Johannes Taxacher
You're right, Michael, fixing Bug #54836 will also include a fix for the problem reported here, so I am marking this as duplicate. Thanks for your help!
[20 Dec 2010 9:02] Michael Kakuschky
Still existing in 5.2.31a