Bug #53835 ENUM defaults should force quotes when it is a string
Submitted: 20 May 2010 7:27 Modified: 10 Jul 2013 21:42
Reporter: Daniel Jann Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.20, 5.2.21 OS:Any (XP PRO, Mac OS X)
Assigned to: CPU Architecture:Any
Tags: DEFAULT, enum

[20 May 2010 7:27] Daniel Jann
Description:
When entering a string into the default value of an ENUM, the UI doesn't surround it with quotes, resulting in an unvalid SQL export for the CREATE TABLE statement.

How to repeat:
Enter an unquoted string into the default value of an ENUM typed column. Then export to SQL and you have unvalid SQL...

Suggested fix:
The UI should surround with quotes values entered by the user into the default value of an ENUM typed field. It does surround default values with quotes for VARCHAR for instance, why shouldn't it do it for ENUM ? If it is because the user should also be able to enter the index of the ENUM and in this case quotes are unwanted, then just don't surround it with quotes when the string entered by the user happens to be an integer.
[20 May 2010 7:58] Valeriy Kravchuk
Please, check with a newer version, 5.2.21. I do not see this problem with it.
[20 May 2010 9:29] Valeriy Kravchuk
5.2.21 is available at http://dev.mysql.com/downloads/workbench/5.2.html. Why the need and possibility to upgrade is not recognized by the tool is another topic.
[20 May 2010 9:56] Daniel Jann
table with an enum field where the default is not surrounded by quotes

Attachment: enumbug.mwb (application/octet-stream, text), 4.80 KiB.

[20 May 2010 9:59] Daniel Jann
Updated to 5.2.21, the problem is still there. I've uploaded an example file. Try to generate SQL from it, it won't be valid SQL (missing quotes around default value)
[20 May 2010 19:06] Valeriy Kravchuk
Sorry, it was my fault - I checked inserting rows with explicit values set for ENUM columns.

Verified with .mwb file uploaded on 5.2.21.
[25 May 2010 16:17] Johannes Taxacher
Workbench currently auto-quotes only default for text-datatypes. we have that on our improve-list for later versions
[27 May 2010 7:13] Daniel Jann
Ok, thanks!
[28 Jun 2010 9:15] Valeriy Kravchuk
Bug #54858 was marked as a duplicate of this one.
[10 Jul 2013 21:42] Philip Olson
Fixed as of MySQL Workbench 6.0.3 (BETA 2), and here's the changelog entry:

The default value for an "ENUM" was not quoted.

Thank you for the bug report.