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

Explicit column name error in CTE of UNION

Details

    Description

      The bug described in MDEV-15478 is not fully resolved. When the CTE is used again with UNION in the main statement, it gives error #1054 - Unknown column 'col1' in 'field list'

      WITH cte (col1) AS
      (
        SELECT 1
        UNION
        SELECT 2
      )
      SELECT col1 FROM cte
      -- union statement added to example in MDEV-15478
      UNION
      SELECT col1 FROM cte
      

      This can currently be worked around with:

      WITH cte (col1) AS
      (
        SELECT 1 AS col1 -- alias required
        UNION
        SELECT 2
      )
      SELECT col1 FROM cte
      UNION
      SELECT col1 FROM cte
      

      Attachments

        Issue Links

          Activity

            tarrin Tarrin Wills created issue -
            tarrin Tarrin Wills made changes -
            Field Original Value New Value
            alice Alice Sherepa made changes -
            Affects Version/s 10.2 [ 14601 ]
            Affects Version/s 10.3 [ 22126 ]
            Affects Version/s 10.4 [ 22408 ]
            Affects Version/s 10.5 [ 23123 ]
            alice Alice Sherepa made changes -
            Fix Version/s 10.2 [ 14601 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            alice Alice Sherepa made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            alice Alice Sherepa made changes -
            Assignee Igor Babaev [ igor ]
            igor Igor Babaev (Inactive) made changes -
            Status Confirmed [ 10101 ] In Progress [ 3 ]
            igor Igor Babaev (Inactive) made changes -
            Summary Explicit column name error in CTE of UNION - with UNION in main statement Explicit column name error in CTE of UNION
            igor Igor Babaev (Inactive) made changes -
            Assignee Igor Babaev [ igor ] Dmitry Shulga [ JIRAUSER47315 ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            shulga Dmitry Shulga made changes -
            Status In Review [ 10002 ] Stalled [ 10000 ]
            igor Igor Babaev (Inactive) made changes -
            Assignee Dmitry Shulga [ JIRAUSER47315 ] Igor Babaev [ igor ]
            igor Igor Babaev (Inactive) made changes -
            Fix Version/s 10.2.38 [ 25207 ]
            Fix Version/s 10.3.29 [ 25206 ]
            Fix Version/s 10.4.19 [ 25205 ]
            Fix Version/s 10.5.10 [ 25204 ]
            Fix Version/s 10.2 [ 14601 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 118143 ] MariaDB v4 [ 158778 ]

            People

              igor Igor Babaev (Inactive)
              tarrin Tarrin Wills
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.