Skip to content

fix: implement pgx.Rows TypeMap for pgx v5.11 - #63

Merged
iamralch merged 1 commit into
mainfrom
fix/pgx-rows-typemap
Sep 23, 2026
Merged

iamralch merged 1 commit into
mainfrom
fix/pgx-rows-typemap

Conversation

@iamralch

Copy link
Copy Markdown
Contributor

main doesn't compile against github.com/jackc/pgx/v5 v5.11.0 (required since #59), because v5.11.0 added TypeMap() *pgtype.Map to the pgx.Rows interface:

querier.go:104:10: cannot use &Rows{…} (value of type *Rows) as pgx.Rows value in return statement: *Rows does not implement pgx.Rows (missing method TypeMap)

This also blocks downstream consumers from taking pgx 5.11 (e.g. hellohippo/pharmacy-api#469).

Changes

  • Rows.TypeMap() returns the registry it already uses to scan cached rows.
  • RowsRecorder.TypeMap() delegates to the wrapped pgx.Rows.
  • RowsError.TypeMap() returns nil, which pgx documents as valid for a Rows "representing only an error".
  • MockRows in tests gets a matching TypeMapFn, plus one spec per new method.

Verification

  • go build ./... and go vet ./... clean
  • ginkgo ./... against Postgres 17 (PGX_DATABASE_URL set): 67/67 specs passed, 0 skipped

pgx v5.11.0 added TypeMap() to the pgx.Rows interface, so Rows,
RowsRecorder and RowsError no longer satisfied it and the package failed
to compile.

- Rows returns the registry it already scans cached rows with.
- RowsRecorder delegates to the wrapped rows.
- RowsError returns nil, which pgx documents as valid for a Rows that
  carries only an error.
@iamralch
iamralch merged commit d67793b into main Sep 23, 2026
3 checks passed
@iamralch
iamralch deleted the fix/pgx-rows-typemap branch September 23, 2026 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant