Bug #11719 Incorrect warning when out of the set value is inserted in the column.
Submitted: 4 Jul 2005 12:03 Modified: 4 Jul 2005 12:47
Reporter: Disha Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.7-beta OS:Windows (Windows 2000 Server)
Assigned to: CPU Architecture:Any

[4 Jul 2005 12:03] Disha
Description:
If an out of the set value is inserted in a SET Column an incorrect warning is displayed as "Out of range value adjusted".

How to repeat:
1. Start the MySQL client and connect to the database with valid user and password.
2. Set the delimiter to //
3. Create a table as follows:
   Create table t1(f1 set('a','b','c'))//

4. Now insert an out of set value in the column as follows:
   insert into t1 values('x')//

Expected Results: 
1. Appropriate error should be displayed as value not in set.

Actual Results: 
1. No error is displayed and a warning is displayed as "Warning | 1265 | Data truncated for column 'f1' at row 1".
2. This creates an impression that data is being inserted in the column where as no data is inserted.
[4 Jul 2005 12:47] MySQL Verification Team
http://dev.mysql.com/doc/mysql/en/insert.html

 If you are not running in strict mode, any column not explicitly given a value
 is set to its default (explicit or implicit) value. For example, if you specify
 a column list that doesn't name all the columns in the table, unnamed columns are
 set to their default values. Default value assignment is described in Section 13.2.5,
 “CREATE TABLE Syntax”. See Section 1.7.6.2, “Constraints on Invalid Data”.

c:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.9-beta-nt

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

mysql> delimiter //
mysql> Create table t1(f1 set('a','b','c'))//
Query OK, 0 rows affected (0.06 sec)

mysql> insert into t1 values('x')//
Query OK, 1 row affected, 1 warning (0.02 sec)

mysql> select f1+0 from t1//
+------+
| f1+0 |
+------+
|    0 |
+------+
1 row in set (0.00 sec)

mysql> set sql_mode="traditional"//
Query OK, 0 rows affected (0.00 sec)

mysql> insert into t1 values('x')//
ERROR 1265 (01000): Data truncated for column 'f1' at row 1
mysql> select f1+0 from t1//
+------+
| f1+0 |
+------+
|    0 |
+------+
1 row in set (0.00 sec)

mysql>