You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If anyone else runs into this issue and lands on this page, I found it usually works if you explicitly annotate the appropriate type on the sqlc argument:
-- name: CTERef :one
WITH t1_ids AS (
SELECT id FROM t1
)
SELECT*FROM t1_ids WHEREt1_ids.id=sqlc.arg('id')::integer;
-- ^^^^^^^^^
This makes sqlc happy for now, until the above fix is merged.
The SQL in the link is silly, as I have reduced the case as much as possible.
The actual query is trying to retrieve a single record with some conditions and insert a modified version of the same record using input provided by the user.
Version
1.27.0
What happened?
Resolving references to multiple CTE's with arguments fails.
This is a duplicate of #3219, but 3219 has been closed even thought the issue still persists and the relevant PR is not merged.
PR to fix this issue: #3220
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/9048b486f822c300301650867612e42bef8f8d512dfd12d84ad3a4cd210f4ef7
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: