Bug #9894 Strict Mode: Allows inserting -ve values in decimal(20) unsigned fields
Submitted: 14 Apr 2005 10:09 Modified: 8 Jun 2005 9:31
Reporter: Disha Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3 OS:Windows (Windows 2003)
Assigned to: Alexey Botchkov CPU Architecture:Any

[14 Apr 2005 10:09] Disha
Description:
The mode is set to traditional.

A table having a unsigned decimal field Allows inserting -ve values in decimal(20) unsigned fields. The issue does not repro with the length is specified less that 20.

This occurs on all database engines viz. (MyISAM, Innodb, Memory).

How to repeat:
1. delimiter //
2. Set @@sql_mode='traditional'//
3. Create table t14( d1 decimal(18) unsigned, d2 decimal(20) unsigned, 
                            d3 decimal (22) unsigned)//
4. Insert into t14 Values(-1,-1,-1)//
5. Insert into t14 Values(1,-1,-1)//

ACTUAL RESULT:
1) After step 4, error message displayed as value not accepted for d1.
2) After step 5, record is inserted into t14. 

EXPECTED RESULT:
1) After step 4 or 5, since strict_mode is set, values should not be accepted.
[14 Apr 2005 14:06] Jorge del Conde
Verified w/5.0.4 from bk:

mysql> delimiter //
mysql> Set @@sql_mode='traditional'//
Query OK, 0 rows affected (0.00 sec)

mysql> Create table t14( d1 decimal(18) unsigned, d2 decimal(20) unsigned, 
    ->   d3 decimal (22) unsigned)//
Query OK, 0 rows affected (0.00 sec)

mysql> Insert into t14 Values(-1,-1,-1)//
ERROR 1264 (22003): Out of range value adjusted for column 'd1' at row 1
mysql>  Insert into t14 Values(1,-1,-1)//
Query OK, 1 row affected (0.00 sec)

mysql>
[8 Jun 2005 7:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25743
[8 Jun 2005 9:31] Alexey Botchkov
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html