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

Explicit column name error in CTE of UNION

    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

          Activity

            People

            • Assignee:
              shagalla Galina Shalygina
              Reporter:
              midenok Aleksey Midenkov
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: