Unsorted result for query with ORDER BY if ref_or_null access is used

Bug #1002139 reported by Igor Babaev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Confirmed
Medium
Oleksandr "Sanja" Byelkin

Bug Description

The following sequence of commands produces unsorted result in MariaDB 5.2 though sorting is asked for:

CREATE TABLE t1 (
  a INT,
  c INT,
  UNIQUE KEY a_c (a,c),
  KEY (a)) engine=myisam;

INSERT INTO t1 VALUES (1,10), (2,NULL), (2,10);
ANALYZE TABLE t1;
EXPLAIN
SELECT c FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
SELECT c FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;

MariaDB [test]> SELECT c FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
+------+
| c |
+------+
| 10 |
| NULL |
+------+

In MariaDB the test case works correctly.

See also bug #13531865 from mysql-trunk code line.

Changed in maria:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Oleksandr "Sanja" Byelkin (sanja-byelkin)
milestone: none → 5.2
Revision history for this message
Oleksandr "Sanja" Byelkin (sanja-byelkin) wrote :

It is 5.2 only bug.

Changed in maria:
status: Confirmed → In Progress
status: In Progress → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.