List:Internals« Previous MessageNext Message »
From:timour Date:March 10 2005 12:52pm
Subject:bk commit into 5.0 tree (timour:1.1797) BUG#7425
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of timka. When timka 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.1797 05/03/10 13:52:00 timour@stripped +4 -0
  Manual merge of fix for BUG#7425.

  sql/item.cc
    1.122 05/03/10 13:51:56 timour@stripped +1 -1
    Merged fix for BUG#7425.

  sql/filesort.cc
    1.100 05/03/10 12:55:42 timour@stripped +0 -0
    Auto merged

  mysql-test/t/select.test
    1.40 05/03/10 12:55:42 timour@stripped +11 -11
    Auto merged

  mysql-test/r/select.result
    1.53 05/03/10 12:55:42 timour@stripped +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:	timour
# Host:	zmei.home
# Root:	/home/timka/mysql/src/5.0-dbg/RESYNC

--- 1.99/sql/filesort.cc	2005-02-28 16:22:22 +02:00
+++ 1.100/sql/filesort.cc	2005-03-10 12:55:42 +02:00
@@ -694,12 +694,18 @@
 	  to[3]= (uchar) (value >> 32);
 	  to[2]= (uchar) (value >> 40);
 	  to[1]= (uchar) (value >> 48);
-	  to[0]= (uchar) (value >> 56) ^ 128;	// Fix sign
+          if (item->unsigned_flag)                    /* Fix sign */
+            to[0]= (uchar) (value >> 56);
+          else
+            to[0]= (uchar) (value >> 56) ^ 128;	/* Reverse signbit */
 #else
 	  to[3]= (uchar) value;
 	  to[2]= (uchar) (value >> 8);
 	  to[1]= (uchar) (value >> 16);
-	  to[0]= (uchar) (value >> 24) ^ 128;	// Fix sign
+          if (item->unsigned_flag)                    /* Fix sign */
+            to[0]= (uchar) (value >> 24);
+          else
+            to[0]= (uchar) (value >> 24) ^ 128;	/* Reverse signbit */
 #endif
 	  break;
 	}

--- 1.121/sql/item.cc	2005-03-09 09:25:09 +02:00
+++ 1.122/sql/item.cc	2005-03-10 13:51:56 +02:00
@@ -3721,6 +3721,7 @@
     alias_name_used= ((Item_ident *) (*ref))->alias_name_used;
   else
     alias_name_used= TRUE; // it is not field, so it is was resolved by alias
+  unsigned_flag= (*ref)->unsigned_flag;
   fixed= 1;
 }
 

--- 1.52/mysql-test/r/select.result	2005-02-17 15:03:42 +02:00
+++ 1.53/mysql-test/r/select.result	2005-03-10 12:55:42 +02:00
@@ -2423,3 +2423,26 @@
 city
 London
 DROP TABLE t1;
+create table t1 (a int(11) unsigned, b int(11) unsigned);
+insert into t1 values (1,0), (1,1), (1,2);
+select a-b  from t1 order by 1;
+a-b
+0
+1
+18446744073709551615
+select a-b , (a-b < 0)  from t1 order by 1;
+a-b	(a-b < 0)
+0	0
+1	0
+18446744073709551615	0
+select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
+d	(a-b >= 0)	b
+1	1	0
+0	1	1
+18446744073709551615	1	2
+select cast((a - b) as unsigned) from t1 order by 1;
+cast((a - b) as unsigned)
+0
+1
+18446744073709551615
+drop table t1;

--- 1.39/mysql-test/t/select.test	2005-02-17 15:03:43 +02:00
+++ 1.40/mysql-test/t/select.test	2005-03-10 12:55:42 +02:00
@@ -2004,3 +2004,14 @@
 
 DROP TABLE t1;
 
+#
+# Bug#7425 inconsistent sort order on unsigned columns result of substraction
+#
+
+create table t1 (a int(11) unsigned, b int(11) unsigned);
+insert into t1 values (1,0), (1,1), (1,2);
+select a-b  from t1 order by 1;
+select a-b , (a-b < 0)  from t1 order by 1;
+select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
+select cast((a - b) as unsigned) from t1 order by 1;
+drop table t1;
Thread
bk commit into 5.0 tree (timour:1.1797) BUG#7425timour10 Mar