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

SQL Parsing Error - UNION AND ORDER BY WITH JOIN

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1.3
    • Fix Version/s: 10.1.6
    • Component/s: Optimizer
    • Labels:
    • Environment:
      centos 6
    • Sprint:
      10.1.6-1

      Description

      This test case is not working on MariaDB 10.1.3:

      CREATE TABLE
      	test ( id INT, type_id INT, PRIMARY KEY(id) );
      	
      INSERT INTO 
      	test ( id, type_id )
      VALUES 
      	( 1, 1 ),
      	( 2, 1 ),
      	( 3, 2 ),
      	( 4, 5 );
      	
      SELECT
      	*
      FROM
      	test T
      	JOIN (
      		(
      			SELECT 1 AS some_another_type_id
      		)
      		UNION ALL
      		(
      			SELECT 2 AS some_another_type_id
      		)
      		ORDER BY
      			some_another_type_id DESC
      	) AAA
      WHERE
      	T.type_id = 1;

      Same query on clean Mysql 5.6 working with no problems.
      Workaround: delete unneeded "order by".

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              svoj Sergey Vojtovich
              Reporter:
              m.rygiel m.rygiel
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: