Bug #49404 Forward engineer SQL CREATE Script does not enclose ENUM default value in quotes
Submitted: 3 Dec 2009 14:55 Modified: 11 Dec 2009 14:56
Reporter: Kris Willis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Documentation Severity:S3 (Non-critical)
Version:5.1.18 OS:Linux
Assigned to: CPU Architecture:Any
Tags: DEFAULT, export

[3 Dec 2009 14:55] Kris Willis
Description:
When exporting a database with the "Forward engineer SQL CREATE Script" option, where a table has an ENUM() field with a default value that is not numeric, the resulting SQL file does not enclose these default values with single quotes, causing an error when importing into MySQL.

How to repeat:
1. Create a table with an ENUM() field, with a non-numeric default value.
2. Export with "Forward engineer SQL CREATE Script"
3. $ mysql -u foo -pbar < database.sql

Suggested fix:
Enclose non-numeric default ENUM() values in single quotes.
[8 Dec 2009 13:42] Susanne Ebrecht
Many thanks for writing a bug report.

Unfortunately, this is not a bug. You need to quote it by yourself.

I will set this as documentation bug because you are right, there is a description about this missing in the documentation.
[11 Dec 2009 14:56] Tony Bedford
The main documentation has been updated:

Caution

Care must be taken when entering a default value for non-numeric ENUM columns. When entering a non-numeric default value it will not be automatically quoted. You must manually add single quote characters for the default value. Note that MySQL Workbench will not prevent you from entering the default value without the single quotes. If a non-numerical default value is entered without quotes, this will lead to errors. For example, if the model is reverse engineered, the script will contain unquoted default values for ENUM columns and will fail if an attempt is made to run the script on MySQL Server.

A note was not added to the changelog, as this was not a bug in Workbench.