List:Commits« Previous MessageNext Message »
From:ramil Date:January 19 2007 8:50am
Subject:bk commit into 5.0 tree (ramil:1.2379)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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, 2007-01-19 12:50:14+04:00, ramil@stripped +3 -0
  Merge rkalimullin@stripped:/home/bk/mysql-5.0-maint
  into  mysql.com:/usr/home/ram/work/bug22026/my50-bug22026
  MERGE: 1.2248.183.1

  mysql-test/r/select.result@stripped, 2007-01-19 12:49:58+04:00, ramil@stripped +0 -0
    merging
    MERGE: 1.138.1.2

  mysql-test/t/select.test@stripped, 2007-01-19 12:49:58+04:00, ramil@stripped +0 -1
    merging
    MERGE: 1.112.3.1

  sql/item_cmpfunc.cc@stripped, 2007-01-19 12:41:30+04:00, ramil@stripped +0 -0
    Auto merged
    MERGE: 1.222.1.1

# 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/my50-bug22026/RESYNC

--- 1.228/sql/item_cmpfunc.cc	2007-01-19 12:50:36 +04:00
+++ 1.229/sql/item_cmpfunc.cc	2007-01-19 12:50:36 +04:00
@@ -26,13 +26,17 @@
 
 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)
     return REAL_RESULT;
-  else if (a == DECIMAL_RESULT || b == DECIMAL_RESULT)
+  else if (a == DECIMAL_RESULT || b == DECIMAL_RESULT ||
+           unsigned_flag != item->unsigned_flag)
     return DECIMAL_RESULT;
   else
     return INT_RESULT;
@@ -41,6 +45,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 */
@@ -49,6 +54,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;
     }
@@ -57,7 +63,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.145/mysql-test/r/select.result	2007-01-19 12:50:36 +04:00
+++ 1.146/mysql-test/r/select.result	2007-01-19 12:50:36 +04:00
@@ -3534,6 +3534,35 @@ id	a	b	c	d	e
 2	NULL	NULL	NULL	2	40
 2	NULL	NULL	NULL	2	50
 DROP TABLE t1,t2,t3;
+create table t1 (a bigint unsigned);
+insert into t1 values
+(if(1, 9223372036854775808, 1)),
+(case when 1 then 9223372036854775808 else 1 end),
+(coalesce(9223372036854775808, 1));
+select * from t1;
+a
+9223372036854775808
+9223372036854775808
+9223372036854775808
+drop table t1;
+create table t1 select
+if(1, 9223372036854775808, 1) i,
+case when 1 then 9223372036854775808 else 1 end c,
+coalesce(9223372036854775808, 1) co;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `i` decimal(19,0) NOT NULL default '0',
+  `c` decimal(19,0) NOT NULL default '0',
+  `co` decimal(19,0) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select 
+if(1, cast(1111111111111111111 as unsigned), 1) i,
+case when 1 then cast(1111111111111111111 as unsigned) else 1 end c,
+coalesce(cast(1111111111111111111 as unsigned), 1) co;
+i	c	co
+1111111111111111111	1111111111111111111	1111111111111111111
 create table t1 (c1 varchar(1), c2 int, c3 int, c4 int, c5 int, c6 int,
 c7 int, c8 int, c9 int, fulltext key (`c1`));
 select distinct match (`c1`) against ('z') , c2, c3, c4,c5, c6,c7, c8 

--- 1.119/mysql-test/t/select.test	2007-01-19 12:50:36 +04:00
+++ 1.120/mysql-test/t/select.test	2007-01-19 12:50:36 +04:00
@@ -3007,7 +3007,29 @@ SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1
 SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id
   WHERE t1.id=2;
 
-DROP TABLE t1,t2,t3;
+
+#
+# Bug #22026: Warning when using IF statement and large unsigned bigint
+#
+
+create table t1 (a bigint unsigned);
+insert into t1 values
+  (if(1, 9223372036854775808, 1)),
+  (case when 1 then 9223372036854775808 else 1 end),
+  (coalesce(9223372036854775808, 1));
+select * from t1;
+drop table t1;
+create table t1 select
+  if(1, 9223372036854775808, 1) i,
+  case when 1 then 9223372036854775808 else 1 end c,
+  coalesce(9223372036854775808, 1) co;
+show create table t1;
+drop table t1;
+# Ensure we handle big values properly
+select 
+  if(1, cast(1111111111111111111 as unsigned), 1) i,
+  case when 1 then cast(1111111111111111111 as unsigned) else 1 end c,
+  coalesce(cast(1111111111111111111 as unsigned), 1) co;
 
 #
 # Bug#20503: Server crash due to the ORDER clause isn't taken into account
Thread
bk commit into 5.0 tree (ramil:1.2379)ramil19 Jan