> Yes, the DEFAULT doesn't apply. However, shouldn't MySQL
> raise an exception because '' isn't a valid value for this ENUM
> >From http://www.mysql.com/doc/en/ENUM.html
> The value may also be the empty string ("") or NULL under certain
> 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.
ok, but the table was defined as:
create table property (
property_id int(10) unsigned NOT NULL auto_increment,
name char(30) default NULL,
changeday enum('Sun','Mon','Tue','Wed','Thu','Fri','Sat') not null
PRIMARY KEY (property_id)
"changeday" is NOT NULL -> but you still can enter
'' ... Strange and, IMO, a bug. What's the use of
restricting to a set of possible values without enforcing it?
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL