Commit db93db85 authored by unknown's avatar unknown

Merge


mysql-test/r/select.result:
  Auto merged
mysql-test/t/select.test:
  Auto merged
sql/filesort.cc:
  Auto merged
sql/item.cc:
  SCCS merged
parents 2f7e93af 146df30f
...@@ -2423,3 +2423,26 @@ SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; ...@@ -2423,3 +2423,26 @@ SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
city city
London London
DROP TABLE t1; 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;
...@@ -2004,3 +2004,14 @@ SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; ...@@ -2004,3 +2004,14 @@ SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
DROP TABLE t1; 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;
...@@ -694,12 +694,18 @@ static void make_sortkey(register SORTPARAM *param, ...@@ -694,12 +694,18 @@ static void make_sortkey(register SORTPARAM *param,
to[3]= (uchar) (value >> 32); to[3]= (uchar) (value >> 32);
to[2]= (uchar) (value >> 40); to[2]= (uchar) (value >> 40);
to[1]= (uchar) (value >> 48); 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 #else
to[3]= (uchar) value; to[3]= (uchar) value;
to[2]= (uchar) (value >> 8); to[2]= (uchar) (value >> 8);
to[1]= (uchar) (value >> 16); 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 #endif
break; break;
} }
......
...@@ -3717,6 +3717,7 @@ void Item_ref::set_properties() ...@@ -3717,6 +3717,7 @@ void Item_ref::set_properties()
split_sum_func() doesn't try to change the reference. split_sum_func() doesn't try to change the reference.
*/ */
with_sum_func= (*ref)->with_sum_func; with_sum_func= (*ref)->with_sum_func;
unsigned_flag= (*ref)->unsigned_flag;
if ((*ref)->type() == FIELD_ITEM) if ((*ref)->type() == FIELD_ITEM)
alias_name_used= ((Item_ident *) (*ref))->alias_name_used; alias_name_used= ((Item_ident *) (*ref))->alias_name_used;
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment