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

sql/analyzer/life_ctes.go: Add an analyzer rule to lift CTEs so they are visible across unions and distinct nodes. #370

Merged
merged 2 commits into from
Apr 14, 2021

Conversation

reltuk
Copy link
Contributor

@reltuk reltuk commented Apr 12, 2021

No description provided.

…are visible across unions and distinct nodes.
@reltuk reltuk requested a review from zachmu April 12, 2021 23:42
Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG nice catch!

// (WITH t AS SELECT ... SELECT ...) UNION ...
// where the CTE will be visible on the second half of the UNION. We live with
// it for now.
func liftCommonTableExpressions(ctx *sql.Context, a *Analyzer, n sql.Node, scope *Scope) (sql.Node, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably just put this in the same file as resolve_ctes

@reltuk reltuk merged commit faa9080 into master Apr 14, 2021
@Hydrocharged Hydrocharged deleted the aaron/lift-ctes-over-unions-and-distincts branch December 8, 2021 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants