Bug #47515 Incorrect CREATE TABLE syntax in Forward Engineer CREATE Script
Submitted: 22 Sep 2009 11:35 Modified: 22 Sep 2009 13:22
Reporter: Craig Fowler Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.2.3 alpha OS:Linux (Debian Squeeze/KDE)
Assigned to: CPU Architecture:Any
Tags: Broken, export

[22 Sep 2009 11:35] Craig Fowler
The SQL generated by File » Export » Forward Engineer Create Script is incorrect and creates MySQL errors when run against a database.

The error in the syntax is that a close-parenthesis is left off in the CREATE TABLE syntax, causing mysql to reject the script when imported into a database.

I have worked around this for now by using sed to add an extra close-paren before any instances of the word "ENGINE" in the generated script and have verified that mysql now permits the db structure to be imported.

How to repeat:
Create a new workbench model, create one table in that model and give it a column.

Click File » Export » Forward Engineer Create Script » Uncheck any of the options present and pick an output file

Move through the rest of the process and save the .sql file

Now try importing that .sql file into a mysql database, it will generate a mysql error.

I haven't tried this fully with combinations of tickboxes ticked/unticked in the first dialog of Forward Engineer Create Script - I have only tried it with "everything unticked".

Suggested fix:
Correct the syntax error
[22 Sep 2009 11:37] Craig Fowler
A .sql export created from a new model (following the steps in "How to Reproduce").  Comments show where the error is

Attachment: foo.sql (text/x-sql), 798 bytes.

[22 Sep 2009 13:22] Valeriy Kravchuk
Please do not submit the same bug more than once. An existing bug report, bug #47407, already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.