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

Wrong results from query, using brackets with ORDER BY ..LIMIT

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.4
    • Fix Version/s: 10.4.5
    • Component/s: Parser
    • Labels:
      None

      Description

      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (10),(20),(30);
      SELECT a FROM t1 order by a desc limit 1;
      (SELECT a FROM t1 order by a desc) limit 1;
      

      MariaDB [test]> SELECT a FROM t1 order by a desc limit 1;
      +------+
      | a    |
      +------+
      |   30 |
      +------+
      1 row in set (0.002 sec)
       
      MariaDB [test]> (SELECT a FROM t1 order by a desc) limit 1;
      +------+
      | a    |
      +------+
      |   10 |
      +------+
      1 row in set (0.001 sec)
      

        Attachments

          Activity

            People

            • Assignee:
              igor Igor Babaev
              Reporter:
              alice Alice Sherepa
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: