mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug #42760: Select doesn't return desired results when we have null values
Part 2 : There was a special optimization on the ref access method for ORDER BY ... DESC that was set without actually looking on the type of the selected index for ORDER BY. Fixed the SELECT ... ORDER BY .. DESC (it uses a different code path compared to the ASC that has been fixed with the previous fix).
This commit is contained in:
@ -1111,5 +1111,14 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
|
||||
col
|
||||
1
|
||||
# Must use ref-or-null on the a_c index
|
||||
EXPLAIN
|
||||
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
x x x ref_or_null a_c,a x x x x x
|
||||
# Must return 1 row
|
||||
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC;
|
||||
col
|
||||
1
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user