Below is the list of changes that have just been committed into a local
5.0 repository of uchum. When uchum 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@stripped, 2007-06-09 03:36:32+05:00, gshchepa@stripped +3 -0
Fixed bug #28625:
DECIMAL column was used instead of BIGINT for the minimal possible
BIGINT (-9223372036854775808).
The Item_func_neg::fix_length_and_dec has been adjusted to not set
hybrid_type to DECIMAL_RESULT for abs(LONGLONG_MIN) argument value.
mysql-test/r/bigint.result@stripped, 2007-06-09 03:35:36+05:00, gshchepa@stripped +7 -0
Added test case for bug #28625.
mysql-test/t/bigint.test@stripped, 2007-06-09 03:35:34+05:00, gshchepa@stripped +8 -0
Added test result for bug #28625.
sql/item_func.cc@stripped, 2007-06-09 03:36:05+05:00, gshchepa@stripped +7 -1
Fixed bug #28625.
The Item_func_neg::fix_length_and_dec has been adjusted to not set
hybrid_type to DECIMAL_RESULT for abs(LONGLONG_MIN) argument value.
# 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: gshchepa
# Host: gleb.loc
# Root: /home/uchum/work/bk/5.0-opt-28625
--- 1.344/sql/item_func.cc 2007-06-01 02:17:03 +05:00
+++ 1.345/sql/item_func.cc 2007-06-09 03:36:05 +05:00
@@ -1522,10 +1522,16 @@ void Item_func_neg::fix_length_and_dec()
(This is how multiplication and other integer functions works)
Use val() to get value as arg_type doesn't mean that item is
Item_int or Item_real due to existence of Item_param.
+
+ NOTE: below we use the fact of "two's complement" representation of
+ signed numbers: -(longlong)LONGLONG_MIN == (longlong) LONGLONG_MIN.
+ So, it is ok to use INT_RESULT for Item_uint with value of
+ (ulonglong) LONGLONG_MIN: applying Item_func_neg::int_op to that value
+ we'll obtain correct result: (longlong) LONGLONG_MIN.
*/
if (hybrid_type == INT_RESULT &&
args[0]->type() == INT_ITEM &&
- ((ulonglong) args[0]->val_int() >= (ulonglong) LONGLONG_MIN))
+ ((ulonglong) args[0]->val_int() > (ulonglong) LONGLONG_MIN))
{
/*
Ensure that result is converted to DECIMAL, as longlong can't hold
--- 1.35/mysql-test/r/bigint.result 2007-05-16 10:12:48 +05:00
+++ 1.36/mysql-test/r/bigint.result 2007-06-09 03:35:36 +05:00
@@ -362,3 +362,10 @@ cast(-19999999999999999999 as signed)
-9223372036854775808
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
+create table t1 select -9223372036854775808;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `-9223372036854775808` bigint(20) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
--- 1.30/mysql-test/t/bigint.test 2007-05-16 10:12:48 +05:00
+++ 1.31/mysql-test/t/bigint.test 2007-06-09 03:35:34 +05:00
@@ -294,3 +294,11 @@ drop table t1;
select cast(19999999999999999999 as signed);
select cast(-19999999999999999999 as signed);
+
+#
+# Bug #28625: -9223372036854775808 doesn't fit in BIGINT.
+#
+
+create table t1 select -9223372036854775808;
+show create table t1;
+drop table t1;
| Thread |
|---|
| • bk commit into 5.0 tree (gshchepa:1.2506) BUG#28625 | gshchepa | 8 Jun |