Bug #7416 Generated ALTER TABLE commamd obmits quoutes for enum default
Submitted: 19 Dec 2004 21:38 Modified: 5 Jan 2005 13:39
Reporter: Holger Kunst Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S3 (Non-critical)
Version:1.1.3 OS:Windows (Win XP, SP2)
Assigned to: CPU Architecture:Any

[19 Dec 2004 21:38] Holger Kunst
Description:
In MySQL table editor when changing the schema for a colum of type ENUM the generated ALTER TABLE commamd obmits quotes for enum default default value. The ALTER table command then fails with a syntax error.

This is the genrated output:
ALTER TABLE `xyz`.`appointments` MODIFY COLUMN `class` ENUM('appointment','blocked','holiday') NOT NULL DEFAULT appointment;

It should be:
ALTER TABLE `moneyfitness2`.`appointments` MODIFY COLUMN `class` ENUM('appointment','blocked','holiday') NOT NULL DEFAULT 'appointment';

How to repeat:
Generate a table with a colum of type ENUM, assign a defualt value
Atempt to modift the schema by adding a new ENUM value
ALTER TABLE will fail with syntax error 

Suggested fix:
Insert quotes around default value for ENUM
[19 Dec 2004 21:41] Holger Kunst
different table name 'moneyfitness2' vs. 'xyz' in "should be" section has nothing to do with the bug - just a obmission on my side to change it when generating the example
[5 Jan 2005 13:39] Michael G. Zinner
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Thanks for reporting. We now automatically add '' when the user enteres a default value. We cannot always add the '' because you have to be able to enter NULL, too. If we would add '' all the time, it would become 'NULL' what is not what is expected.

But as the '' are added automatically now, it should solve the issue.