From: Martijn Tonies Date: January 5 2004 4:25pm Subject: Re: Enum default values List-Archive: http://lists.mysql.com/mysql/156866 Message-Id: <071a01c3d3a8$783a50c0$0e02a8c0@martijn> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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 : 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