Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: cte and subquery relation name and columns should be registered on query catalog #3755

Closed

Conversation

swallowstalker
Copy link
Contributor

Trying to solve #3720

CTE columns cannot be referred on main query

This is because if table name is not found on catalog, sqlc will attempt to find it on query catalog, but once it is found, it is skipped and not registered on QueryCatalog, making it invisible for it to be referred for the next steps.

if _, qcerr := qc.GetTable(fqn); qcerr != nil {
return nil, err
}
continue

Subquery relation name and columns cannot be referred on WHERE clause

Similar to above case, but this needs to be detected on *ast.RangeSubselect to register alias of subquery and its output column into QueryCatalog

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 🔧 golang labels Dec 20, 2024
@swallowstalker
Copy link
Contributor Author

just realized that there is open PR about this issue after I finished create this MR 👀 for now maybe I will wait for PR #3220 to be merged as it has more complete tests

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files. 🔧 golang
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant