List:General Discussion« Previous MessageNext Message »
From:Jay Blanchard Date:January 5 2004 1:15pm
Subject:RE: Enum default values
View as plain text  
[snip]
Yes, the DEFAULT doesn't apply. However, shouldn't MySQL
raise an exception because '' isn't a valid value for this ENUM
specification?
[/snip]

From http://www.mysql.com/doc/en/ENUM.html

The value may also be the empty string ("") or NULL under certain
circumstances: 

If you insert an invalid value into an ENUM (that is, a string not
present in the list of allowed values), the empty string is inserted
instead as a special error value. This string can be distinguished from
a 'normal' empty string by the fact that this string has the numerical
value 0. More about this later. 
If an ENUM is declared NULL, NULL is also a legal value for the column,
and the default value is NULL. If an ENUM is declared NOT NULL, the
default value is the first element of the list of allowed values. 
Thread
Enum default valuesRichard Dyce5 Jan
RE: Enum default valuesJay Blanchard5 Jan
  • Re: Enum default valuesRichard Dyce5 Jan
    • Re[2]: Enum default valuesAleksandar Bradaric5 Jan
      • Re: Re[2]: Enum default valuesRichard Dyce5 Jan
  • Re: Enum default valuesMartijn Tonies5 Jan
RE: Enum default valuesJay Blanchard5 Jan
  • Re: Enum default valuesMartijn Tonies5 Jan
RE: Enum default valuesJay Blanchard5 Jan
  • Re: Enum default valuesMartijn Tonies5 Jan
    • Re: Enum default valuesMichael Stassen5 Jan
  • Re: Enum default valuesMartijn Tonies5 Jan