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

Explicit column name error in CTE of UNION

    XMLWordPrintable

Details

    Description

      Reproduce

      WITH cte (col1) AS
      (
        SELECT 1
        UNION
        SELECT 2
      )
      SELECT col1 FROM cte;
      

      Result

      ERROR 1054 (42S22): Unknown column 'col1' in 'field list'
      

      Expected

      Query succeeds.

      Notes

      It works without UNION:

      WITH cte (col1) AS
      (
        SELECT 1
      )
      SELECT col1 FROM cte;
      +------+
      | col1 |
      +------+
      |    1 |
      +------+
      

      Attachments

        Issue Links

          Activity

            People

              shagalla Galina Shalygina (Inactive)
              midenok Aleksey Midenkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.