Below is the list of changes that have just been committed into a local
4.1 repository of ram. When ram 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, 2006-10-11 14:36:41+05:00, ramil@stripped +3 -0
Fix for bug #22026: Warning when using IF statement and large unsigned bigint
We don't take into account unsigned_flags aggregating result types.
mysql-test/r/select.result@stripped, 2006-10-11 14:36:36+05:00, ramil@stripped +28 -0
Fix for bug #22026: Warning when using IF statement and large unsigned bigint
- test result.
mysql-test/t/select.test@stripped, 2006-10-11 14:36:37+05:00, ramil@stripped +21 -1
Fix for bug #22026: Warning when using IF statement and large unsigned bigint
- test case.
sql/item_cmpfunc.cc@stripped, 2006-10-11 14:36:37+05:00, ramil@stripped +9 -3
Fix for bug #22026: Warning when using IF statement and large unsigned bigint
- take into account unsigned flags aggregating result types:
return INT_RESULT only if two items with INT_RESULT type
have equal unsigned_flags, otherwise return REAL_RESULT.
# 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: ramil
# Host: myoffice.izhnet.ru
# Root: /usr/home/ram/work/bug22026/my41-bug22026
--- 1.212/sql/item_cmpfunc.cc 2006-10-11 14:36:48 +05:00
+++ 1.213/sql/item_cmpfunc.cc 2006-10-11 14:36:48 +05:00
@@ -27,11 +27,15 @@
static bool convert_constant_item(THD *thd, Field *field, Item **item);
-static Item_result item_store_type(Item_result a,Item_result b)
+static Item_result item_store_type(Item_result a, Item *item,
+ my_bool unsigned_flag)
{
+ Item_result b= item->result_type();
+
if (a == STRING_RESULT || b == STRING_RESULT)
return STRING_RESULT;
- else if (a == REAL_RESULT || b == REAL_RESULT)
+ else if (a == REAL_RESULT || b == REAL_RESULT ||
+ unsigned_flag != item->unsigned_flag)
return REAL_RESULT;
else
return INT_RESULT;
@@ -40,6 +44,7 @@ static Item_result item_store_type(Item_
static void agg_result_type(Item_result *type, Item **items, uint nitems)
{
Item **item, **item_end;
+ my_bool unsigned_flag= 0;
*type= STRING_RESULT;
/* Skip beginning NULL items */
@@ -48,6 +53,7 @@ static void agg_result_type(Item_result
if ((*item)->type() != Item::NULL_ITEM)
{
*type= (*item)->result_type();
+ unsigned_flag= (*item)->unsigned_flag;
item++;
break;
}
@@ -56,7 +62,7 @@ static void agg_result_type(Item_result
for (; item < item_end; item++)
{
if ((*item)->type() != Item::NULL_ITEM)
- *type= item_store_type(type[0], (*item)->result_type());
+ *type= item_store_type(*type, *item, unsigned_flag);
}
}
--- 1.75/mysql-test/r/select.result 2006-10-11 14:36:48 +05:00
+++ 1.76/mysql-test/r/select.result 2006-10-11 14:36:48 +05:00
@@ -2744,3 +2744,31 @@ SELECT i='1e+01',i=1e+01, i in (1e+01),
i='1e+01' i=1e+01 i in (1e+01) i in ('1e+01')
0 1 1 1
DROP TABLE t1;
+create table t1 (a bigint unsigned);
+insert into t1 values
+(if(1, 9223372036854775808, 4321)),
+(case when 1 then 9223372036854775808 else 4321 end),
+(nullif(9223372036854775808, 4321)),
+(coalesce(9223372036854775808, 4321));
+select * from t1;
+a
+9223372036854775808
+9223372036854775808
+9223372036854775808
+9223372036854775808
+drop table t1;
+create table t1 select
+if(1, 9223372036854775808, 4321) i,
+case when 1 then 9223372036854775808 else 4321 end c,
+nullif(9223372036854775808, 4321) nif,
+coalesce(9223372036854775808, 4321) co;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` double(19,0) NOT NULL default '0',
+ `c` double(19,0) NOT NULL default '0',
+ `nif` double(19,0) default NULL,
+ `co` double(19,0) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+End of 4.1 tests
--- 1.58/mysql-test/t/select.test 2006-10-11 14:36:48 +05:00
+++ 1.59/mysql-test/t/select.test 2006-10-11 14:36:48 +05:00
@@ -2297,4 +2297,24 @@ INSERT INTO t1 VALUES (10);
SELECT i='1e+01',i=1e+01, i in (1e+01), i in ('1e+01') FROM t1;
DROP TABLE t1;
-# End of 4.1 tests
+#
+# Bug #22026: Warning when using IF statement and large unsigned bigint
+#
+
+create table t1 (a bigint unsigned);
+insert into t1 values
+ (if(1, 9223372036854775808, 4321)),
+ (case when 1 then 9223372036854775808 else 4321 end),
+ (nullif(9223372036854775808, 4321)),
+ (coalesce(9223372036854775808, 4321));
+select * from t1;
+drop table t1;
+create table t1 select
+ if(1, 9223372036854775808, 4321) i,
+ case when 1 then 9223372036854775808 else 4321 end c,
+ nullif(9223372036854775808, 4321) nif,
+ coalesce(9223372036854775808, 4321) co;
+show create table t1;
+drop table t1;
+
+--echo End of 4.1 tests
| Thread |
|---|
| • bk commit into 4.1 tree (ramil:1.2543) BUG#22026 | ramil | 11 Oct |