List:General Discussion« Previous MessageNext Message »
From:Martijn Tonies Date:January 5 2004 1:01pm
Subject:Re: Enum default values
View as plain text  
Hi,

> [snip]
> insert into property values ('','Book-keeper\'s Cottage','Thu');
> insert into property values ('','Inglenook Barn','Fri');
> insert into property values ('','Maggie\'s House','Fri');
> insert into property values ('','Riverside View','');
> insert into property values ('','The Manse','');
> insert into property values ('','Heathside','');
> select * from property;
>
> +-------------+-----------------------+-----------+
> | property_id | name                  | changeday |
> +-------------+-----------------------+-----------+
> |           1 | Book-keeper's Cottage | Thu       |
> |           2 | Inglenook Barn        | Fri       |
> |           3 | Maggie's House        | Fri       |
> |           4 | Riverside View        |           |
> |           5 | The Manse             |           |
> |           6 | Heathside             |           |
> +-------------+-----------------------+-----------+
> 6 rows in set (0.00 sec)
> [/snip]
>
> All expected and correct behaviour. Why? Because you're specifying a
> blank for the third value in the insert statement.
>
> insert into property values ('','Heathside','');
> insert into property values BLANK, Heathside, BLANK;

Yes, the DEFAULT doesn't apply. However, shouldn't MySQL
raise an exception because '' isn't a valid value for this ENUM
specification?

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com

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