MySQL Forums
Forum List  »  General

ENUM and STRICT MODE
Posted by: James b
Date: February 26, 2009 09:37AM

According to my reading of the manual, specifically http://dev.mysql.com/doc/refman/5.0/en/enum.html
"If strict SQL mode is enabled, attempts to insert invalid ENUM values result in an error. "


Shouldn't this insert be failing with errors?

Thanks in advance, James

Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
mysql> create database teststrict;
Query OK, 1 row affected (0.00 sec)

mysql> use teststrict;
Database changed
mysql> create table test (
-> ID Integer not null primary key,
-> test enum('1','2','3') not null
-> ) engine=innodb;
Query OK, 0 rows affected (0.08 sec)

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

mysql>
mysql> insert into test set ID=1, test='0';
Query OK, 1 row affected (0.01 sec)

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

Options: ReplyQuote


Subject
Written By
Posted
ENUM and STRICT MODE
February 26, 2009 09:37AM
February 27, 2009 08:59AM
March 26, 2009 05:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.