Bug #53780 Forward engineer: SQL script execution finished with errors
Submitted: 19 May 2010 7:32 Modified: 25 May 2010 9:34
Reporter: Mihail Lukin Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S2 (Serious)
Version:5.2.21 OS:Linux (Fedora 12 i686, Ubuntu)
Assigned to: Assigned Account CPU Architecture:Any
Tags: delimiters, forward engineer, syntax errors

[19 May 2010 7:32] Mihail Lukin
Description:
"DROP objects before each CREATE statement" doesn't handle delimiters well. CREATE SQL script generated may look like this:

-- -----------------------------------------------------
-- function ip_in_net
-- -----------------------------------------------------
USE `mydb`$$
DROP function IF EXISTS `mydb`.`ip_in_net`$$
SHOW WARNINGS;

DELIMITER $$
USE `ipdb`$$
CREATE FUNCTION `ipdb`.`ip_in_net` (address INT UNSIGNED, network INT UNSIGNED,
        netmask TINYINT UNSIGNED)
...

as you can see, delimiter '$$' was used BEFORE it was declared.

How to repeat:
1. Create model with ROUTINE object
2. Forward engineer to database or export to CREATE SQL script
- Error 1064: You have an error in your SQL syntax

Suggested fix:
- Use default delimiter in DROP OBJECT procedure
or
- Declare '$$' (or whatever) delimiter before statement using it.
[21 May 2010 10:23] Susanne Ebrecht
Many thanks for writing a bug report.

Verified as described.

When you forward a new routine and click drop objects then delimiter is used before defined.
[25 May 2010 9:34] Alexander Musienko
Duplicate of Bug#53853