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

Column alias in UNION with GROUP BY query

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.3.25
    • N/A
    • N/A
    • Ubuntu 20.04.1

    Description

      Simplified sample query
      SELECT greet FROM (SELECT 'hi' AS greet
      UNION SELECT 'hello'
      FROM (SELECT '') AS _ GROUP BY NULL) AS tbl WHERE greet != ''

      Actual result
      [mysqli: 1054] Unknown column 'greet' in 'order clause'

      Expected result
      Query passes (returns 'hihello')

      Additional info
      The following changes each make the query pass:

      • Change line 2 to UNION SELECT 'hello' AS greet
      • Remove the GROUP BY NULL clause

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              evilliger Elias Villiger
              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.