Skip to content

Support CollectExactlyOneRow for pgx #4056

@karelbilek

Description

@karelbilek

What do you want to change?

Pgx now supports CollectExactlyOneRow. This returns error when there is more than 1 resulting row, but doesn't fetch them all.

This could be done by either modifying :one behaviour, or adding :exactlyone annotation.

I think adding :exactlyone annotation is better, because erroring on :one on select where sqlc currently doesn't error is backwards incompatible change, and it doesn't strike me as correct anyway (:one can mean I actually want the first from many, see the pgx thread).

See:

jackc/pgx#1411 (comment)
#3956

If this is desired, I can take a shot at this feature and try to add it myself since it doesn't strike me as that hard (and, sqlc already has annotations that are just for go and just for pgx), but, let's see :)

What database engines need to be changed?

PostgreSQL

What programming language backends need to be changed?

Go

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions