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

CTE renaming columns too early in union subquery elements

    XMLWordPrintable

Details

    Description

      with cte (c1,c2) as (select a, b from t1 union select a, b from t1 order by a ) select * from cte;
      

      provokes an error

      ERROR 1054 (42S22): Unknown column 'a' in 'order clause'

      Where both of these do not

      select a, b from t1 union select a, b from t1 order by a;
      with cte (c1,c2) as (select * from (select a, b from t1 union select a, b from t1 order by b) tt ) select * from cte;
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              Johnston Rex Johnston
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.