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

MySQL and MariaDB results on derived_table are not the same

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 10.0.14, 10.0.21
    • Fix Version/s: N/A
    • Component/s: Optimizer
    • Labels:
      None
    • Environment:
      Linux

      Description

      CREATE DATABASE `derived_issue`;
      
      CREATE TABLE `derived_issue`.`test` (
        `num` int(11) NOT NULL
      );
      
      INSERT INTO `derived_issue`.`test` (num)
      VALUES (12345),(1),(1234),(12),(123),(123456);
      
      SELECT * 
      FROM (
      	SELECT num 
      	FROM `derived_issue`.`test`
      	ORDER BY num DESC
      ) derived_table;
      

      on MariaDB the derived_table result

      12345
      1
      1234
      12
      123
      123456
      

      on MySQL the results is what is expected

      123456
      12345
      1234
      123
      12
      1
      

      not matter what engine or version you use the MariaDB give wrong order

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            zed Gabor Aron added a comment -
            Show
            zed Gabor Aron added a comment - Close this ticket i found the answer https://mariadb.com/kb/en/mariadb/why-is-order-by-in-a-from-subquery-ignored/

              People

              • Assignee:
                Unassigned
                Reporter:
                zed Gabor Aron
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: