Bug #49533 Overflow in DECIMAL, SBR out of sync

Submitted: 8 Dec 2009 13:08 Modified: 8 Dec 2009 13:18
Reporter: Matthias Leich Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.1,mysql-5.1-rep+3,mysql-6.0-codebase-b OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[8 Dec 2009 13:08] Matthias Leich
Description:
My script:
----------
--source include/master-slave.inc
CREATE TABLE t1 ( f1 DECIMAL(10,0), pk INT , PRIMARY KEY (pk)) ENGINE = MyISAM;

let $my_value= 17313807292449161216;
eval SET @aux = $my_value;
     INSERT INTO t1 ( f1 , pk ) VALUES ( @aux      , 1 );
eval INSERT INTO t1 ( f1 , pk ) VALUES ( $my_value , 2 );

SELECT * FROM t1 ORDER BY pk;
sync_slave_with_master;
connection slave;
SELECT * FROM t1 ORDER BY pk;

The result when running with binlog_format STATEMENT OR MIXED:
--------------------------------------------------------------
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 ( f1 DECIMAL(10,0), pk INT , PRIMARY KEY (pk)) ENGINE = MyISAM;
SET @aux = 17313807292449161216;
INSERT INTO t1 ( f1 , pk ) VALUES ( @aux      , 1 );
Warnings:
Warning	1264	Out of range value for column 'f1' at row 1
INSERT INTO t1 ( f1 , pk ) VALUES ( 17313807292449161216 , 2 );
Warnings:
Warning	1264	Out of range value for column 'f1' at row 1
SELECT * FROM t1 ORDER BY pk;
f1	pk
9999999999	1
9999999999	2
SELECT * FROM t1 ORDER BY pk;
f1	pk
-9999999999	1    <================
9999999999	2

Observations:
-------------
1. The result is correct when using binlog_format ROW
2. The following source trees show the bug
   mysql-5.1-bugteam revno: 3200 2009-11-13
   mysql-5.1-rep+3   revno: 3124 2009-12-02
   mysql-6.0-codebase-bugfixing revno: 3755 2009-12-04
3. This bug is not storage engine specific
   An InnoDB table shows the same effect.

How to repeat:
See above
[8 Dec 2009 13:18] Matthias Leich
SET SQL_MODE='STRICT_ALL_TABLES'
could be used as workaround but I fear this is in
some applications not acceptable.

My environment:
---------------
- MySQL compiled from source
  ./BUILD/compile-pentium64-debug-max
- Linux OpenSuSE 11.0 (64 Bit)
- Intel Core2Duo

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
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.