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

ORDER BY not working correctly in subquery

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Not a Bug
    • 10.0.17, 10.1.3
    • N/A
    • None
    • 10.1.3 - CentOS 6
      10.0.17 - Windows 7

    Description

      This test case

      SELECT
      	*
      FROM
      	(
      		SELECT
      			*
      		FROM
      			(
      					SELECT
      						1 AS agency_id,
      						15 AS employee_id
      				UNION ALL 
      					SELECT
      						1 AS agency_id,
      						200 AS employee_id
      				UNION ALL
      					SELECT
      						1 AS agency_id,
      						688 AS employee_id
      				UNION ALL
      					SELECT
      						2 AS agency_id,
      						1 AS employee_id
      				UNION ALL 
      					SELECT
      						2 AS agency_id,
      						2 AS employee_id
      			) MN
      		ORDER BY
      			MN.agency_id ASC,
      			MN.employee_id DESC
      	) T
      GROUP BY
      	T.agency_id

      ...produce diffrent results comparing to standard MySQL 5.6 edition.

      MySQL 5.6 standard result:
      "1" "688"
      "2" "2"

      MariaDB 10.1.3 / 10.0.17 result:
      "1" "15"
      "2" "1"

      As u can see - data is re-ordered again after leaving subquery, this is potentially very serious bug.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            m.rygiel m.rygiel
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.