One thing that has always bugged me about ENUM is well.... an example:

===========================================

mysql> create table test (
    ->     field1 enum('val1', 'val2') not null default 'val1'
    -> );
Query OK, 0 rows affected (0.21 sec)

mysql> insert into test set field1='val3';
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> select * from test;
+--------+
| field1 |
+--------+
|        |
+--------+
1 row in set (0.00 sec)

mysql> SET SESSION sql_mode='STRICT_ALL_TABLES';
Query OK, 0 rows affected (0.00 sec)

mysql> insert into test set field1='val3';
ERROR 1265 (01000): Data truncated for column 'field1' at row 1
mysql> select * from test;
+--------+
| field1 |
+--------+
|        |
+--------+
1 row in set (0.00 sec)

===========================================

So, in non-strict mode (drizzle gonna have more than one mode?), we get a field inserted with an empty value. Not the default value?!?! IMO, it should either fail on insert/update or should use the default value. Using a value that is not part of the allowed values seems crazy to me.

In strict mode, I get a cryptic error message about a truncated column, but there is no insert. It does not tell me there is no insert, it just fails with a cryptic message.

thoughts?

--

Brian Moon
Senior Web Engineer
------------------------------
When you care enough to spend the very least.
http://dealnews.com/


_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to