mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix for BUG#7425.
The reported problems were due to two completely unrelated omissions. 1) The file sort procedure didn't correctly create the sort key in make_sortkey when the sortkey was an unsigned integer. 2) The name resolution procedure for column references inside a HAVING clause did not propagate the unsigned_flag of the resolved references. This patch corrects both problems. mysql-test/r/select.result: Added test result for BUG#7425. mysql-test/t/select.test: Added test for BUG#7425. sql/filesort.cc: Take into account whether 'item' represents a signed or an unsigned integer. sql/item.cc: Once an Item_ref is resolved, propagate the unsigned_flag to the resolved item.
This commit is contained in:
@ -2422,3 +2422,26 @@ SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
|
||||
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;
|
||||
|
Reference in New Issue
Block a user