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

Wrong result when using IN subquery with order by

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5.37, 10.0.11
    • Fix Version/s: 5.5.38, 10.0.12
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu Precise, also Ubuntu 14.04

      Description

      I got a wrong result in two different machines

      I tried after uploading the prueba.sql file the following query:

      SELECT * FROM agentes WHERE id in (select distinct id_agente from otra) ORDER BY nombre ASC;

      I get:

      +----+--------+
      | id | nombre |
      +----+--------+
      |  1 | row 1  |
      |  1 | row 1  |
      |  1 | row 1  |
      |  2 | row 2  |
      |  2 | row 2  |
      |  3 | row 3  |
      +----+--------+

      but if I remove the order by clause I get:

      +----+--------+
      | id | nombre |
      +----+--------+
      |  1 | row 1  |
      |  2 | row 2  |
      |  3 | row 3  |
      +----+--------+

      I don't put much more information i think it's very reproductible since i got it in two different machines.

        Attachments

          Activity

            People

            • Assignee:
              psergey Sergei Petrunia
              Reporter:
              satonio jose antonio
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: