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

Subquery with CTE does not see tables from the outer query

    XMLWordPrintable

    Details

      Description

      Note: I'm not sure whether it's supposed to work, but it looks suspicious.

      create table t1 (i int);
      create table t2 (j int);
       
      # This of course works:
      select * from t1 where exists ( select * from t2 where j = i );
      # Empty set (0.01 sec)
       
      # But this does not:
      select * from t1 where exists ( with cte as ( select * from t2 where j = i ) select * from cte );
      # ERROR 1054 (42S22): Unknown column 'i' in 'where clause'
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              igor Igor Babaev
              Reporter:
              elenst Elena Stepanova
              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.