Potential regression in sql.Scanner
handling when using pgx.CollectRows
#2229
Labels
sql.Scanner
handling when using pgx.CollectRows
#2229
Describe the bug
As of
v5.7.2
When usingpgx.CollectRows
to collect rows into a struct that contains a pointer to a struct that implementssql.Scanner
, if the column in the database isNULL
, the corresponding struct is no longernil
.v5.7.1
- the example below printstestData[1].Value was nil struct
and thetestData[1].Value
isnil
as expected.v5.7.2
- the example below printsexpected testData[1].Value to be nil struct
and thetestData[1].Value
is no longer nil.This seems to have been introduced with #2151, is this an expected change?
Is it possible to work around this to ensure that the pointer values are still nil?
To Reproduce
Steps to reproduce the behavior:
If possible, please provide runnable example such as:
go mod tidy && go get github.com/jackc/pgx/[email protected] && go run main.go
go mod tidy && go get github.com/jackc/pgx/[email protected] && go run main.go
Expected behavior
I expected the behaviour to continue between versions, and that the
NULL
column would map to anil
struct value.Actual behavior
The
NULL
column no longer produces anil
struct value.Version
$ go version
-> go version go1.23.1 darwin/arm64Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: