Bug #54836 | Forward engineering model fails with routines | ||
---|---|---|---|
Submitted: | 27 Jun 2010 11:26 | Modified: | 7 Mar 2011 15:05 |
Reporter: | Karsten Wutzke | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Workbench: Modeling | Severity: | S3 (Non-critical) |
Version: | 5.2.24 RC | OS: | Windows (7) |
Assigned to: | Alexander Musienko | CPU Architecture: | Any |
Tags: | forward engineer, routines |
[27 Jun 2010 11:26]
Karsten Wutzke
[27 Jun 2010 12:38]
Valeriy Kravchuk
Verified just as described with your .mwb file uploaded. This is where the problem starts: ... CREATE INDEX `teams_teamtypes_fk` ON `Teams` (`teamtype_code` ASC) ; -- ----------------------------------------------------- -- function generate_team_type_code -- ----------------------------------------------------- DROP function IF EXISTS `generate_team_type_code`$$ ... Here $$ is used before it is declared as DELIMITER.
[6 Jul 2010 17:28]
Bion Pohl
I can confirm that this is a problem with the Mac version as well. It seems that without 'Drop Objects' checked it will not put a 'DELIMITER $$' at the beginning of the routine definitions. Even with 'Drop Object' the '$$' delimiter is not put at the end of each routine's definition. Also, the last routine doesn't get an EOL after the final 'END' and the delimiter is not reset to ';'. In my case I end up with 'ENDUSE `dbname`;' which fails. Adding the delimiter in the editor doesn't help because it is stripped off when saved. A related problem is it seems to collect Carriage Return characters (^M) as I cut-n-paste. If I edit the generated SQL when it is shown just before execution and add the '$$' delimiter and fix the last routine's last line, then the script execute successfully. This is a quick scrip I made I call fixWBsql.bsh which tries to do the editing for me. (Replace the '^M' with real Carriage Returns.) #!/bin/bash cat "$1" | sed '/^$/N;/\n$/N;//D; s/^ *ENDUSE .*$/END;$$/g; s/^ *END$/END;/g; s/^ *END;$/END;$$/g; s/^DROP VIEW/DELIMITER ;^MDROP VIEW/' | \ tr "^M" "\n"
[8 Oct 2010 17:57]
Johannes Taxacher
the original problem is fixed in repository, but there's still some delimiter mixup going on to be cleaned up.
[26 Nov 2010 16:56]
Johannes Taxacher
Bug #56784 has been marked as duplicate
[3 Mar 2011 13:36]
Johannes Taxacher
fix confirmed in repository
[7 Mar 2011 15:05]
Tony Bedford
An entry has been added to the 5.2.32 changelog: When forward engineering a model, the generated script resulted in SQL errors when executed on the server. This happened when the following options were selected: DROP Objects Before Each CREATE Object Omit Schema Qualifier in Object Names Generate Separate CREATE INDEX Statements Generate INSERT Statements for Tables