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
I was expecting it to fail withpgx.ErrTooManyRows if the query returns more than one row but what i found was it picks the first row and just ignores the rest. sqlc codegen for pgx uses QueryRow method of pgx which has the behavior of ignoring all the rows but one if there are multiple, would it be possible to use Query along with CollectExactlyOneRow in place of QueryRow(jackc/pgx#1411 (comment)) ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using sqlc with pgx/v5 in go, for a delete query with :one annotation for eg.
I was expecting it to fail with
pgx.ErrTooManyRows
if the query returns more than one row but what i found was it picks the first row and just ignores the rest. sqlc codegen for pgx usesQueryRow
method of pgx which has the behavior of ignoring all the rows but one if there are multiple, would it be possible to useQuery
along withCollectExactlyOneRow
in place ofQueryRow
(jackc/pgx#1411 (comment)) ?sqlc/internal/codegen/golang/templates/pgx/queryCode.tmpl
Lines 26 to 47 in 34f8c1b
Beta Was this translation helpful? Give feedback.
All reactions