List:Internals« Previous MessageNext Message »
From:Krunal Bauskar Date:April 21 2008 6:12am
Subject:MySQL doesn't register empty string as part of valid ENUM value list though allows it as part of insert.
View as plain text  
Hi,

For MySQL ENUM data-type user is suppose to create table with some
pre-defined values for ENUM.

For e.g:

CREATE TABLE sizes (
    name ENUM('small', 'medium', 'large')
);

MySQL meta-data registers enum values viz. small/medium/large
If user inserts a value which is not found in this cache and MySQL is operating
in non-strict mode, MySQL will handover an empty string to Storage Engine.

But now if user tries to select from this table using "select *", SE will again
handover an empty string as done by MySQL during insert time but this
handing over fails as MySQL refuses to accept this value.
(MySQL tries to verify if value is register value but couldn't find it
 as part of its internal list maintained using typelib->type_names[])

MyISAM doesn't hit this as MyISAM doesn't feed value using store method from
field.cc

This looks like a MySQL bugs. For now I can always use '' string during
create DDL but that is kind of more restrictive.

Is there a way to register this automatically within MySQL ?

-- 
Regards,
Krunal Bauskar
Thread
MySQL doesn't register empty string as part of valid ENUM value list though allows it as part of insert.Krunal Bauskar21 Apr
  • re: MySQL doesn't register empty string as part of valid ENUM value list though allows it as part of insert.Michael Widenius22 Apr