-
Notifications
You must be signed in to change notification settings - Fork 978
Closed
Labels
Description
Version
1.12.0
What happened?
I have a query that takes id as its only input, and also returns id as its only output.
That causes the function arg and a variable to be called id, thus failing compilation.
Fascinating is that this only breaks with pgx/v4, not with database/sql. The latter seems to reuse the variable and make it work.
Relevant log output
gendb/queries.sql.go:16:6: id redeclared in this block
gendb/queries.sql.go:14:68: previous declarationDatabase schema
No response
SQL queries
INSERT INTO authors (name) SELECT name FROM authors a WHERE a.id = $1 RETURNING id;Configuration
No response
Playground URL
https://play.sqlc.dev/p/d7186cbc2c17613b4ab6fc927330fb20d7848c5c7eb75e975e8d3e55a53a279a
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go