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

>
> This usually comes up when people expect an exception to be thrown when
> they assign NULL to a NOT NULL column, but this is the same idea.  From
> the manual <http://www.mysql.com/doc/en/constraint_NOT_NULL.html>:

Indeed. One of those weird MySQL things. Is this different on InnoDB?

> > To be able to support easy handling of non-transactional tables all
> > fields in MySQL have default values.
> >
> > If you insert a 'wrong' value in a column like a NULL in a NOT NULL
> > column or a too big numerical value in a numerical column, MySQL will
> > instead of giving an error instead set the column to the 'best
> > possible value'.
>
> In the case of ENUMs, "best possible" means the special error value
> which is 0 in numeric context and '' in string context.

Well, so it seems. We learn new things every day.

> Supporting non-transactional tables is the key here.  Throwing an error
> in the middle of a multi row insert is a problem if you cannot roll
> back.

Time to phase out those tables :-)

>Hence, data integrity checking is the responsibility of the
> client/programmer.

Ouch.

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