Skip to content

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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