mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
fix for the bug #2419: order by ignores rows.
null_ref_key moved to TABLE_REF. new null range created if necessary. mysql-test/r/order_by.result: fix for the bug #2419: order by ignores rows mysql-test/t/order_by.test: fix for the bug #2419: order by ignores rows sql/item_subselect.cc: fix for the bug #2419: order by ignores rows sql/opt_range.cc: fix for the bug #2419: order by ignores rows sql/sql_select.cc: fix for the bug #2419: order by ignores rows sql/sql_select.h: fix for the bug #2419: order by ignores rows
This commit is contained in:
@ -590,3 +590,24 @@ SELECT id FROM t1 WHERE id <11984 AND menu =2 ORDER BY id DESC LIMIT 1 ;
|
||||
id
|
||||
11392
|
||||
drop table t1;
|
||||
create table t1(a int, b int, index(b));
|
||||
insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2);
|
||||
explain select * from t1 where b=1 or b is null order by a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref_or_null b b 5 const 3 Using where; Using filesort
|
||||
select * from t1 where b=1 or b is null order by a;
|
||||
a b
|
||||
1 1
|
||||
2 1
|
||||
3 NULL
|
||||
4 NULL
|
||||
explain select * from t1 where b=2 or b is null order by a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref_or_null b b 5 const 4 Using where; Using filesort
|
||||
select * from t1 where b=2 or b is null order by a;
|
||||
a b
|
||||
3 NULL
|
||||
4 NULL
|
||||
5 2
|
||||
6 2
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user