-
Notifications
You must be signed in to change notification settings - Fork 902
Closed as not planned
Closed as not planned
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
Version
Other
What happened?
From working on #2449 I discovered that sqlc doesn't handle some valid queries with function calls like current_date
in FROM clauses correctly. I have only tried this with postgresql, but a similar issue may be present for other engines.
For the query SELECT * FROM current_date;
sqlc generates a function returning a struct with no fields, which is of course not the desired result.
For the query SELECT date FROM current_date AS date;
(which is perfectly valid) sqlc just prints an error:
query.sql:2:8: column "date" does not exist
Here's psql output for that query:
postgres=# SELECT date FROM current_date AS date;
date
------------
2023-07-13
(1 row)
Relevant log output
No response
Database schema
No response
SQL queries
SELECT * FROM current_date;
SELECT date FROM current_date AS date;
Configuration
No response
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working