MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexey Kopytov Date:September 12 2006 2:43pm
Subject:bk commit into 5.1 tree (kaa:1.2354)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kaa. When kaa 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-09-12 18:43:38+04:00, kaa@stripped +12 -0
  Merge polly.local:/tmp/20924/bug20294/my50-bug20294
  into  polly.local:/tmp/20924/bug20294/my51-bug20294
  MERGE: 1.1810.2066.4

  mysql-test/r/case.result@stripped, 2006-09-12 18:34:39+04:00, kaa@stripped +0 -0
    Auto merged
    MERGE: 1.24.2.3

  mysql-test/r/func_if.result@stripped, 2006-09-12 18:34:39+04:00, kaa@stripped +0 -0
    Auto merged
    MERGE: 1.21.1.1

  mysql-test/r/func_test.result@stripped, 2006-09-12 18:34:39+04:00, kaa@stripped +0 -0
    Auto merged
    MERGE: 1.29.1.1

  mysql-test/r/user_var.result@stripped, 2006-09-12 18:43:35+04:00, kaa@stripped +1 -5
    Manual merge
    MERGE: 1.37.2.1

  mysql-test/t/case.test@stripped, 2006-09-12 18:34:39+04:00, kaa@stripped +0 -0
    Auto merged
    MERGE: 1.18.1.2

  mysql-test/t/user_var.test@stripped, 2006-09-12 18:43:35+04:00, kaa@stripped +2 -9
    Manual merge
    MERGE: 1.33.1.1

  sql/item_cmpfunc.cc@stripped, 2006-09-12 18:34:39+04:00, kaa@stripped +0 -0
    Auto merged
    MERGE: 1.187.6.1

  sql/item_cmpfunc.h@stripped, 2006-09-12 18:34:39+04:00, kaa@stripped +0 -0
    Auto merged
    MERGE: 1.122.3.1

  sql/item_func.cc@stripped, 2006-09-12 18:43:35+04:00, kaa@stripped +0 -17
    Manual merge
    MERGE: 1.270.19.2

  sql/item_func.h@stripped, 2006-09-12 18:43:35+04:00, kaa@stripped +1 -2
    Manual merge
    MERGE: 1.136.13.1

  sql/log_event.cc@stripped, 2006-09-12 18:34:40+04:00, kaa@stripped +0 -0
    Auto merged
    MERGE: 1.174.1.35

  sql/sql_class.h@stripped, 2006-09-12 18:34:40+04:00, kaa@stripped +0 -1
    Auto merged
    MERGE: 1.230.27.9

# 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:	kaa
# Host:	polly.local
# Root:	/tmp/20924/bug20294/my51-bug20294/RESYNC

--- 1.216/sql/item_cmpfunc.cc	2006-09-12 18:43:45 +04:00
+++ 1.217/sql/item_cmpfunc.cc	2006-09-12 18:43:45 +04:00
@@ -745,11 +745,7 @@ int Arg_comparator::compare_int_signed_u
     if (!(*b)->null_value)
     {
       owner->null_value= 0;
-      if (sval1 < 0 || (ulonglong)sval1 < uval2)
-        return -1;
-      if ((ulonglong)sval1 == uval2)
-        return 0;
-      return 1;
+      return ::compare_int_signed_unsigned(sval1, uval2);
     }
   }
   owner->null_value= 1;
@@ -770,13 +766,7 @@ int Arg_comparator::compare_int_unsigned
     if (!(*b)->null_value)
     {
       owner->null_value= 0;
-      if (sval2 < 0)
-        return 1;
-      if (uval1 < (ulonglong)sval2)
-        return -1;
-      if (uval1 == (ulonglong)sval2)
-        return 0;
-      return 1;
+      return ::compare_int_unsigned_signed(uval1, sval2);
     }
   }
   owner->null_value= 1;
@@ -1417,11 +1407,13 @@ Item_func_ifnull::int_op()
   if (!args[0]->null_value)
   {
     null_value=0;
+    unsigned_flag= args[0]->unsigned_flag;
     return value;
   }
   value=args[1]->val_int();
   if ((null_value=args[1]->null_value))
     return 0;
+  unsigned_flag= args[1]->unsigned_flag;
   return value;
 }
 
@@ -1572,6 +1564,7 @@ Item_func_if::val_int()
   Item *arg= args[0]->val_bool() ? args[1] : args[2];
   longlong value=arg->val_int();
   null_value=arg->null_value;
+  unsigned_flag= arg->unsigned_flag;
   return value;
 }
 
@@ -1820,6 +1813,7 @@ longlong Item_func_case::val_int()
   }
   res=item->val_int();
   null_value=item->null_value;
+  unsigned_flag= item->unsigned_flag;
   return res;
 }
 
@@ -2006,7 +2000,10 @@ longlong Item_func_coalesce::int_op()
   {
     longlong res=args[i]->val_int();
     if (!args[i]->null_value)
+    {
+      unsigned_flag= args[i]->unsigned_flag;  
       return res;
+    }
   }
   null_value=1;
   return 0;

--- 1.129/sql/item_cmpfunc.h	2006-09-12 18:43:45 +04:00
+++ 1.130/sql/item_cmpfunc.h	2006-09-12 18:43:45 +04:00
@@ -1411,3 +1411,17 @@ inline Item *and_conds(Item *a, Item *b)
 }
 
 Item *and_expressions(Item *a, Item *b, Item **org_item);
+
+inline int compare_int_signed_unsigned(longlong sval, ulonglong uval)
+{
+  if (sval < 0 || (ulonglong)sval < uval)
+    return -1;
+  if ((ulonglong)sval == uval)
+    return 0;
+  return 1;
+}
+
+inline int compare_int_unsigned_signed(ulonglong uval, longlong sval)
+{
+  return -compare_int_signed_unsigned(sval, uval);
+}

--- 1.311/sql/item_func.cc	2006-09-12 18:43:45 +04:00
+++ 1.312/sql/item_func.cc	2006-09-12 18:43:45 +04:00
@@ -2169,18 +2169,33 @@ longlong Item_func_min_max::val_int()
 {
   DBUG_ASSERT(fixed == 1);
   longlong value=0;
+  my_bool arg_unsigned_flag;
+  my_bool cmp;
   for (uint i=0; i < arg_count ; i++)
   {
+    longlong tmp= args[i]->val_int();
+    if ((null_value= args[i]->null_value))
+      break;
+    arg_unsigned_flag= args[i]->unsigned_flag;
     if (i == 0)
-      value=args[i]->val_int();
+    {
+      value= tmp;
+      unsigned_flag= arg_unsigned_flag;
+    }
     else
     {
-      longlong tmp=args[i]->val_int();
-      if (!args[i]->null_value && (tmp < value ? cmp_sign : -cmp_sign) > 0)
-	value=tmp;
+      if (unsigned_flag == arg_unsigned_flag)
+        cmp= tmp < value;
+      else if (unsigned_flag)
+        cmp= compare_int_signed_unsigned(tmp, value) < 0;
+      else
+        cmp= compare_int_unsigned_signed(tmp, value) < 0;
+      if ((cmp ? cmp_sign : -cmp_sign) > 0)
+      {
+        value= tmp;
+        unsigned_flag= arg_unsigned_flag;
+      }
     }
-    if ((null_value= args[i]->null_value))
-      break;
   }
   return value;
 }
@@ -3821,7 +3836,7 @@ Item_func_set_user_var::update()
   case REAL_RESULT:
   {
     res= update_hash((void*) &save_result.vreal,sizeof(save_result.vreal),
-		     REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT);
+		     REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
     break;
   }
   case INT_RESULT:
@@ -3835,23 +3850,23 @@ Item_func_set_user_var::update()
   {
     if (!save_result.vstr)					// Null value
       res= update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin,
-		       DERIVATION_IMPLICIT);
+		       DERIVATION_IMPLICIT, 0);
     else
       res= update_hash((void*) save_result.vstr->ptr(),
 		       save_result.vstr->length(), STRING_RESULT,
 		       save_result.vstr->charset(),
-		       DERIVATION_IMPLICIT);
+		       DERIVATION_IMPLICIT, 0);
     break;
   }
   case DECIMAL_RESULT:
   {
     if (!save_result.vdec)					// Null value
       res= update_hash((void*) 0, 0, DECIMAL_RESULT, &my_charset_bin,
-                       DERIVATION_IMPLICIT);
+                       DERIVATION_IMPLICIT, 0);
     else
       res= update_hash((void*) save_result.vdec,
                        sizeof(my_decimal), DECIMAL_RESULT,
-                       &my_charset_bin, DERIVATION_IMPLICIT);
+                       &my_charset_bin, DERIVATION_IMPLICIT, 0);
     break;
   }
   case ROW_RESULT:

--- 1.148/sql/item_func.h	2006-09-12 18:43:45 +04:00
+++ 1.149/sql/item_func.h	2006-09-12 18:43:45 +04:00
@@ -1202,7 +1202,7 @@ public:
   String *val_str(String *str);
   my_decimal *val_decimal(my_decimal *);
   bool update_hash(void *ptr, uint length, enum Item_result type,
-  		   CHARSET_INFO *cs, Derivation dv, bool unsigned_arg= 0);
+  		   CHARSET_INFO *cs, Derivation dv, bool unsigned_arg);
   bool send(Protocol *protocol, String *str_arg);
   void make_field(Send_field *tmp_field);
   bool check(bool use_result_field);

--- 1.237/sql/log_event.cc	2006-09-12 18:43:46 +04:00
+++ 1.238/sql/log_event.cc	2006-09-12 18:43:46 +04:00
@@ -3923,7 +3923,7 @@ int User_var_log_event::exec_event(struc
     a single record and with a single column. Thus, like
     a column value, it could always have IMPLICIT derivation.
    */
-  e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT);
+  e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT, 0);
   free_root(thd->mem_root,0);
 
   rli->inc_event_relay_log_pos();

--- 1.30/mysql-test/r/case.result	2006-09-12 18:43:46 +04:00
+++ 1.31/mysql-test/r/case.result	2006-09-12 18:43:46 +04:00
@@ -200,3 +200,10 @@ CEMPNUM	EMPMUM1	EMPNUM2
 0.00	0	0.00
 2.00	2	NULL
 DROP TABLE t1,t2;
+SELECT CASE 1 WHEN 1 THEN 18446744073709551615 ELSE 1 END;
+CASE 1 WHEN 1 THEN 18446744073709551615 ELSE 1 END
+18446744073709551615
+SELECT COALESCE(18446744073709551615);
+COALESCE(18446744073709551615)
+18446744073709551615
+End of 4.1 tests

--- 1.30/mysql-test/r/func_test.result	2006-09-12 18:43:46 +04:00
+++ 1.31/mysql-test/r/func_test.result	2006-09-12 18:43:46 +04:00
@@ -204,3 +204,10 @@ NULL
 SELECT GREATEST(1.5E+2,1.3E+2,NULL) FROM DUAL;
 GREATEST(1.5E+2,1.3E+2,NULL)
 NULL
+SELECT GREATEST(1, 18446744073709551615);
+GREATEST(1, 18446744073709551615)
+18446744073709551615
+SELECT LEAST(1, 18446744073709551615);
+LEAST(1, 18446744073709551615)
+1
+End of 4.1 tests

--- 1.20/mysql-test/t/case.test	2006-09-12 18:43:46 +04:00
+++ 1.21/mysql-test/t/case.test	2006-09-12 18:43:46 +04:00
@@ -133,8 +133,6 @@ select min(a), min(case when 1=1 then a 
 from t1 where b=3 group by b;
 drop table t1;
 
-# End of 4.1 tests
-
 
 #
 # Tests for bug #9939: conversion of the arguments for COALESCE and IFNULL
@@ -154,3 +152,12 @@ SELECT IFNULL(t2.EMPNUM,t1.EMPNUM) AS CE
   FROM t1 LEFT JOIN t2 ON t1.EMPNUM=t2.EMPNUM;
 
 DROP TABLE t1,t2;
+#
+# Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various
+# functions
+# - UNSIGNED values in CASE and COALESCE are treated as SIGNED
+#
+SELECT CASE 1 WHEN 1 THEN 18446744073709551615 ELSE 1 END;
+SELECT COALESCE(18446744073709551615);
+
+--echo End of 4.1 tests

--- 1.22/mysql-test/r/func_if.result	2006-09-12 18:43:46 +04:00
+++ 1.23/mysql-test/r/func_if.result	2006-09-12 18:43:46 +04:00
@@ -128,3 +128,10 @@ f1	f2	if(f1, 40.0, 5.00)
 0	0	5.00
 1	1	40.00
 drop table t1;
+SELECT IF(1 != 0, 18446744073709551615, 1);
+IF(1 != 0, 18446744073709551615, 1)
+18446744073709551615
+SELECT IFNULL(NULL, 18446744073709551615);
+IFNULL(NULL, 18446744073709551615)
+18446744073709551615
+End of 4.1 tests

--- 1.41/mysql-test/r/user_var.result	2006-09-12 18:43:46 +04:00
+++ 1.42/mysql-test/r/user_var.result	2006-09-12 18:43:46 +04:00
@@ -301,3 +301,4 @@ select @var;
 @var
 3
 drop table t1;
+End of 4.1 tests

--- 1.35/mysql-test/t/user_var.test	2006-09-12 18:43:46 +04:00
+++ 1.36/mysql-test/t/user_var.test	2006-09-12 18:43:46 +04:00
@@ -144,8 +144,6 @@ select @@version;
 --replace_column 1 #
 select @@global.version;
 
-# End of 4.1 tests
-
 #
 # Bug #6598: problem with cast(NULL as signed integer);
 #
@@ -212,3 +210,5 @@ insert into t1 values (1,2),(2,3),(3,1);
 select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
 select @var;
 drop table t1;
+
+--echo End of 4.1 tests
Thread
bk commit into 5.1 tree (kaa:1.2354)Alexey Kopytov12 Sep