2
0

CollectOneRow prefers PostgreSQL error over pgx.ErrorNoRows

fixes https://github.com/jackc/pgx/issues/1334
This commit is contained in:
Jack Christensen
2022-10-22 08:44:06 -05:00
parent 11e5f68ff6
commit 6e40968cfc
2 changed files with 32 additions and 0 deletions
+3
View File
@@ -433,6 +433,9 @@ func CollectOneRow[T any](rows Rows, fn RowToFunc[T]) (T, error) {
var err error
if !rows.Next() {
if err = rows.Err(); err != nil {
return value, err
}
return value, ErrNoRows
}