From: Date: March 28 2006 2:07pm Subject: bk commit into 5.0 tree (bar:1.2105) BUG#15098 List-Archive: http://lists.mysql.com/commits/4231 X-Bug: 15098 Message-Id: <200603281207.k2SC7YUS040576@bar.intranet.mysql.r18.ru> Below is the list of changes that have just been committed into a local 5.0 repository of bar. When bar does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2105 06/03/28 17:07:26 bar@stripped +3 -0 Merge mysql.com:/usr/home/bar/mysql-4.1.b15098 into mysql.com:/usr/home/bar/mysql-5.0 Bug#15098 sql/field.cc 1.301 06/03/28 17:07:19 bar@stripped +0 -0 After merge fix mysql-test/r/cast.result 1.40 06/03/28 17:07:19 bar@stripped +8 -8 After merge fix mysql-test/t/cast.test 1.30 06/03/28 17:04:31 bar@stripped +0 -0 Auto merged # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: bar # Host: bar.intranet.mysql.r18.ru # Root: /usr/home/bar/mysql-5.0/RESYNC --- 1.300/sql/field.cc 2006-02-27 16:50:29 +04:00 +++ 1.301/sql/field.cc 2006-03-28 17:07:19 +05:00 @@ -4240,6 +4240,11 @@ else #endif doubleget(j,ptr); + /* Check whether we fit into longlong range */ + if (j <= (double) LONGLONG_MIN) + return (longlong) LONGLONG_MIN; + if (j >= (double) (ulonglong) LONGLONG_MAX) + return (longlong) LONGLONG_MAX; return (longlong) rint(j); } --- 1.39/mysql-test/r/cast.result 2005-11-21 21:10:54 +04:00 +++ 1.40/mysql-test/r/cast.result 2006-03-28 17:07:19 +05:00 @@ -370,3 +370,11 @@ select cast(NULL as decimal(6)) as t1; t1 NULL +CREATE TABLE t1 (f1 double); +INSERT INTO t1 SET f1 = -1.0e+30 ; +INSERT INTO t1 SET f1 = +1.0e+30 ; +SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1; +double_val cast_val +-1e+30 -9223372036854775808 +1e+30 9223372036854775807 +DROP TABLE t1; --- 1.29/mysql-test/t/cast.test 2005-11-21 19:58:31 +04:00 +++ 1.30/mysql-test/t/cast.test 2006-03-28 17:04:31 +05:00 @@ -165,6 +165,15 @@ # select cast(1.0e+300 as signed int); +# +# Bugs: #15098: CAST(column double TO signed int), wrong result +# +CREATE TABLE t1 (f1 double); +INSERT INTO t1 SET f1 = -1.0e+30 ; +INSERT INTO t1 SET f1 = +1.0e+30 ; +SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1; +DROP TABLE t1; + # End of 4.1 tests