Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-767

LP:1002139 - Unsorted result for query with ORDER BY if ref_or_null access is used

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 5.2.15
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      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.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            sanja Oleksandr Byelkin added a comment -

            Re: Unsorted result for query with ORDER BY if ref_or_null access is used
            It is 5.2 only bug.

            Show
            sanja Oleksandr Byelkin added a comment - Re: Unsorted result for query with ORDER BY if ref_or_null access is used It is 5.2 only bug.
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 1002139

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 1002139
            Hide
            sanja Oleksandr Byelkin added a comment -

            It is fixed in 5.3 and above.

            Show
            sanja Oleksandr Byelkin added a comment - It is fixed in 5.3 and above.
            Hide
            sanja Oleksandr Byelkin added a comment -

            Fix to above comment: It is not reproducable on 5.3, 5.5 and 10.0 (10.0-base).

            Show
            sanja Oleksandr Byelkin added a comment - Fix to above comment: It is not reproducable on 5.3, 5.5 and 10.0 (10.0-base).

              People

              • Assignee:
                sanja Oleksandr Byelkin
                Reporter:
                igor Igor Babaev
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: