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

ORDER BY is mixing up rows

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.2.6
    • N/A
    • Optimizer
    • None
    • 10.2.6-MariaDB-10.2.6+maria~xenial-log on Ubuntu 16.04.2 LTS running Linux 4.4.0-57 x86_64

    Description

      Consider the output of the following query:

      MariaDB [music]> SELECT o.id FROM orders o 
      WHERE EXISTS(SELECT 1 FROM payments p WHERE p.orderId = o.id AND p.paymentTypeId = 95);
      +---------+
      | id      |
      +---------+
      | 2009186 |
      | 2017037 |
      +---------+
      2 rows in set (0.00 sec)
      

      Now, if I add an ORDER BY clause, the query still returns two results, but the latter row is repeated (and the former row gone):

      MariaDB [music]> SELECT o.id FROM orders o 
      WHERE EXISTS(SELECT 1 FROM payments p WHERE p.orderId = o.id AND p.paymentTypeId = 95) 
      ORDER BY o.id;
      +---------+
      | id      |
      +---------+
      | 2017037 |
      | 2017037 |
      +---------+
      2 rows in set (0.00 sec)
      

      I have attempted to recreate a minimal test case for the issue, but with not success.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              crishoj Christian Rishøj
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.