-
Notifications
You must be signed in to change notification settings - Fork 951
Closed
Labels
Description
Using sqlc 1.4.0 + Postgres 11.8. This is a reproduction of the same behavior I saw in a real/non-trivial query.
Given:
-- name: Demo :one
SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', @param)::uuid as col1
;
Produces the following:
const demo = `-- name: Demo :one
SELECT uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', $1)::uuid as col1
`
type DemoParams struct {
Param interface{}
Param interface{}
}
// SELECT @other as col2, uuid_generate_v5('7c4597a0-8cfa-4c19-8da0-b8474a36440d', @param::varchar)::uuid as col1
func (q *Queries) Demo(ctx context.Context, arg DemoParams) (uuid.UUID, error) {
row := q.db.QueryRowContext(ctx, demo, arg.Param, arg.Param)
...
The problems that I see are:
- The Param field is duplicated
- The generated string query has only 1 parameter, but QueryContext is called with 2
lsjurczak