List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:April 22 2008 5:23am
Subject:re: 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!

>>>>> "Krunal" == Krunal Bauskar <krunalbauskar@stripped> writes:

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

Krunal> For e.g:

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

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

MySQL will hand over a record where it has an integer representing the
enum value, not a string.

Krunal> But now if user tries to select from this table using "select *", SE will
> again
Krunal> handover an empty string as done by MySQL during insert time but this
Krunal> handing over fails as MySQL refuses to accept this value.

<cut>

SE should return a record populated with values, not strings.
How are you populating the record ?

You can easily shut down any errors during the population by setting
thd->count_cuted_fields to 0.  You must of course set it back to it's
original value when you are done.

Regards,
Monty
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