Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Referring to a CTE in Subsequent CTEs #196

Closed
reata opened this issue Dec 11, 2021 · 0 comments · Fixed by #197
Closed

Support Referring to a CTE in Subsequent CTEs #196

reata opened this issue Dec 11, 2021 · 0 comments · Fixed by #197
Assignees
Labels
enhancement New feature or request

Comments

@reata
Copy link
Owner

reata commented Dec 11, 2021

WITH
cte1 AS (SELECT a FROM tab1),
cte2 AS (SELECT a FROM cte1)
INSERT OVERWRITE TABLE tab2
SELECT a FROM cte2

This is valid syntax and yet now we treat CTE as exactly the same as subquery, while subquery cannot reference previously defined subquery. We should add support for this.

Reference: https://stackoverflow.com/questions/27204824/sql-use-a-reference-of-a-cte-to-another-cte

@reata reata added the enhancement New feature or request label Dec 11, 2021
@reata reata self-assigned this Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant