List:Commits« Previous MessageNext Message »
From:msvensson Date:June 8 2006 1:45pm
Subject:bk commit into 5.0 tree (msvensson:1.2133)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson 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.2133 06/06/08 15:45:47 msvensson@neptunus.(none) +7 -0
  Merge neptunus.(none):/home/msvensson/mysql/bug7498/my41-bug7498
  into  neptunus.(none):/home/msvensson/mysql/bug7498/my50-bug7498

  sql/item_func.h
    1.139 06/06/08 15:45:44 msvensson@neptunus.(none) +0 -2
    Merge, 'update_hash' broken out to static function

  sql/item_func.cc
    1.285 06/06/08 15:45:44 msvensson@neptunus.(none) +2 -3
    Merge, 'update_hash' broken out to static function

  sql/item.cc
    1.219 06/06/08 15:45:43 msvensson@neptunus.(none) +0 -3
    Merge, already in 5.0

  mysql-test/t/user_var.test
    1.34 06/06/08 15:45:43 msvensson@neptunus.(none) +0 -0
    Merge

  mysql-test/r/user_var.result
    1.39 06/06/08 15:45:43 msvensson@neptunus.(none) +36 -36
    Merge

  sql/sql_class.h
    1.289 06/06/08 15:41:56 msvensson@neptunus.(none) +0 -0
    Auto merged

  sql/item_subselect.cc
    1.124 06/06/08 15:41:55 msvensson@neptunus.(none) +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:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/bug7498/my50-bug7498/RESYNC

--- 1.284/sql/item_func.cc	2006-05-09 10:44:13 +02:00
+++ 1.285/sql/item_func.cc	2006-06-08 15:45:44 +02:00
@@ -3408,6 +3408,7 @@
     entry->length=0;
     entry->update_query_id=0;
     entry->collation.set(NULL, DERIVATION_IMPLICIT);
+    entry->unsigned_flag= 0;
     /*
       If we are here, we were called from a SET or a query which sets a
       variable. Imagine it is this:
@@ -3494,6 +3495,7 @@
     type     - type of new value
     cs       - charset info for new value
     dv       - derivation for new value
+    unsigned_arg - indicates if INT_RESULT value is unsigned
 
   RETURN VALUE
     False - success, True - failure
@@ -3501,7 +3503,7 @@
 
 static bool
 update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
-            Item_result type, CHARSET_INFO *cs, Derivation dv)
+            Item_result type, CHARSET_INFO *cs, Derivation dv, bool unsigned_arg)
 {
   if (set_null)
   {
@@ -3549,6 +3551,7 @@
       ((my_decimal*)entry->value)->fix_buffer_pointer();
     entry->length= length;
     entry->collation.set(cs, dv);
+    entry->unsigned_flag= unsigned_arg;
   }
   entry->type=type;
   return 0;
@@ -3648,7 +3651,10 @@
     str->set(*(double*) value, decimals, &my_charset_bin);
     break;
   case INT_RESULT:
-    str->set(*(longlong*) value, &my_charset_bin);
+    if (!unsigned_flag)
+      str->set(*(longlong*) value, &my_charset_bin);
+    else
+      str->set(*(ulonglong*) value, &my_charset_bin);
     break;
   case DECIMAL_RESULT:
     my_decimal2string(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, 0, 0, str);
@@ -3719,6 +3725,7 @@
   case INT_RESULT:
   {
     save_result.vint= args[0]->val_int();
+    unsigned_flag= args[0]->unsigned_flag;
     break;
   }
   case STRING_RESULT:
@@ -3774,7 +3781,8 @@
   case INT_RESULT:
   {
     res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
-		     INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT);
+		     INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
+                     unsigned_flag);
     break;
   }
   case STRING_RESULT:

--- 1.138/sql/item_func.h	2006-05-04 14:30:35 +02:00
+++ 1.139/sql/item_func.h	2006-06-08 15:45:44 +02:00
@@ -1154,8 +1154,6 @@
     String *vstr;
     my_decimal *vdec;
   } save_result;
-  String save_buff;
-  
 
 public:
   LEX_STRING name; // keep it public
@@ -1166,8 +1164,6 @@
   longlong val_int();
   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 check();
   bool update();
   enum Item_result result_type () const { return cached_result_type; }

--- 1.288/sql/sql_class.h	2006-04-13 09:25:52 +02:00
+++ 1.289/sql/sql_class.h	2006-06-08 15:41:56 +02:00
@@ -1954,6 +1954,7 @@
   ulong length;
   query_id_t update_query_id, used_query_id;
   Item_result type;
+  bool unsigned_flag;
 
   double val_real(my_bool *null_value);
   longlong val_int(my_bool *null_value);

--- 1.123/sql/item_subselect.cc	2006-04-28 12:06:51 +02:00
+++ 1.124/sql/item_subselect.cc	2006-06-08 15:41:55 +02:00
@@ -462,8 +462,10 @@
   DBUG_ASSERT(fixed == 1);
   if (!exec() && !value->null_value)
   {
+    longlong nr= value->val_int();
     null_value= 0;
-    return value->val_int();
+    unsigned_flag= value->unsigned_flag;
+    return nr;
   }
   else
   {

--- 1.38/mysql-test/r/user_var.result	2006-04-27 02:09:37 +02:00
+++ 1.39/mysql-test/r/user_var.result	2006-06-08 15:45:43 +02:00
@@ -256,3 +256,39 @@
   `@first_var` longtext
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
+set @a=18446744071710965857;
+select @a;
+@a
+18446744071710965857
+CREATE TABLE `bigfailure` (
+`afield` BIGINT UNSIGNED NOT NULL
+);
+INSERT INTO `bigfailure` VALUES (18446744071710965857);
+SELECT * FROM bigfailure;
+afield
+18446744071710965857
+select * from (SELECT afield FROM bigfailure) as b;
+afield
+18446744071710965857
+select * from bigfailure where afield = (SELECT afield FROM bigfailure);
+afield
+18446744071710965857
+select * from bigfailure where afield = 18446744071710965857;
+afield
+18446744071710965857
+select * from bigfailure where afield = 18446744071710965856+1;
+afield
+18446744071710965857
+SET @a := (SELECT afield FROM bigfailure);
+SELECT @a;
+@a
+18446744071710965857
+SET @a := (select afield from (SELECT afield FROM bigfailure) as b);
+SELECT @a;
+@a
+18446744071710965857
+SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure));
+SELECT @a;
+@a
+18446744071710965857
+drop table bigfailure;

--- 1.33/mysql-test/t/user_var.test	2006-04-27 02:09:37 +02:00
+++ 1.34/mysql-test/t/user_var.test	2006-06-08 15:45:43 +02:00
@@ -144,6 +144,37 @@
 --replace_column 1 #
 select @@global.version;
 
+#
+# Bug #7498 User variable SET saves SIGNED BIGINT as UNSIGNED BIGINT
+#
+
+# First part, set user var to large number and select it
+set @a=18446744071710965857;
+select @a;
+
+# Second part, set user var from large number in table
+# then select it
+CREATE TABLE `bigfailure` (
+  `afield` BIGINT UNSIGNED NOT NULL
+);
+INSERT INTO `bigfailure` VALUES (18446744071710965857);
+SELECT * FROM bigfailure;
+select * from (SELECT afield FROM bigfailure) as b;
+select * from bigfailure where afield = (SELECT afield FROM bigfailure);
+select * from bigfailure where afield = 18446744071710965857;
+# This is fixed in 5.0, to be uncommented there
+#select * from bigfailure where afield = '18446744071710965857';
+select * from bigfailure where afield = 18446744071710965856+1;
+
+SET @a := (SELECT afield FROM bigfailure);
+SELECT @a;
+SET @a := (select afield from (SELECT afield FROM bigfailure) as b);
+SELECT @a;
+SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure));
+SELECT @a;
+
+drop table bigfailure;
+
 # End of 4.1 tests
 
 #
Thread
bk commit into 5.0 tree (msvensson:1.2133)msvensson8 Jun