Bug #5907 Traditional mode: invalid value can be inserted via a stored procedure
Submitted: 5 Oct 2004 18:24 Modified: 4 Apr 2005 22:07
Reporter: Trudy Pelzer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 9.1)
Assigned to: Michael Widenius CPU Architecture:Any

[5 Oct 2004 18:24] Trudy Pelzer
Description:
When sql_mode='traditional', values that are out 
of range for a numeric date type must be rejected. 
But if a stored procedure is inserting an invalid value, 
it still gets silently changed to an in-range value and 
accepted. 

How to repeat:
mysql> set sql_mode='traditional'; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> create table t1 (col1 tinyint) engine=innodb; 
Query OK, 0 rows affected (0.01 sec) 
 
mysql> delimiter // 
 
mysql> create procedure p () begin declare exit handler for sqlexception 
    -> select 'a'; insert into t1 values (200); end;// 
Query OK, 0 rows affected (0.03 sec) 
 
mysql> call p()// 
+---+ 
| a | 
+---+ 
| a | 
+---+ 
1 row in set (0.00 sec) 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> select * from t1// 
+------+ 
| col1 | 
+------+ 
|  127 | 
+------+ 
1 row in set (0.00 sec) 
-- This INSERT should not have happened. The call 
to the procedure should have ended by returning 'a'.
[6 Oct 2004 1:31] MySQL Verification Team
Verified against latest BK source tree.
[4 Apr 2005 21:20] 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/23635
[4 Apr 2005 22:07] Michael Widenius
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

Additional info:

Fixed in 5.0.4
[5 Apr 2005 14:08] 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/23671