-
Notifications
You must be signed in to change notification settings - Fork 733
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
Unnest into alias doesn't define the column #1596
Comments
|
That is indeed the case. |
@kyleconroy I took a stab at solving this issue, but I'm stuck on where to go and wanted to get feedback. There is buildQueryCatalog which will create the catalog for a query, which includes the This seems like a good place to do a search for the alias, but adding it in likely means that we add some sort of pseudo table/pseudo column if we want to fit within the existing structure of the I think it is best to break from constructing a fake table, and I propose that we add a map of The search for aliases also a bit tricky due to this issue but isn't too hard of a problem. Essentially we need to search for a |
I had another idea right after I hit send. The other option we have is to use a rewrite pass for these aliases since During a rewrite we can pattern match the This would require updating the |
any workaround for this issue? |
Closing as a duplicate of #1322 |
Version
1.12.0
What happened?
I guess the parser doesn't understand that the alias after UNNEST defines a column, so when later trying to determine the type of the column, it thinks the column doesn't exist.
Relevant log output
query.sql:2:8: column "x" does not exist
Database schema
No response
SQL queries
Configuration
No response
Playground URL
https://play.sqlc.dev/p/01ee6a49034c018482526ca75aa29cf93aa447d3d93417543266cd4a6d1577b0
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: