PlanScan did not find a plan
when using sql.Scanner
with float4 column (v5)
#1911
Labels
PlanScan did not find a plan
when using sql.Scanner
with float4 column (v5)
#1911
Describe the bug
PlanScan did not find a plan
error when scanningfloat
intosql.Scanner
struct. This works withv4
but fails onv5
.To Reproduce
Database setup:
Expected behavior
Expected that
scanner.Scan
would be called and passed anfloat64
.Actual behavior
Fails before
Scan
is called with error:QueryRow failed: can't scan into dest[0]: PlanScan did not find a plan
Version
go version go1.22.0 windows/amd64
PostgreSQL 15.5 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
github.com/jackc/pgx/v5 v5.5.3
Additional context
If I change to V4 (just change
github.com/jackc/pgx/v5
tojackfan.us.kg/jackc/pgx/v4
) then this runs as expected.I've looked through the code and it appears that the issue is in
pgtype/float4
; inDecodeDatabaseSQLValue
it passes a*float64
intocodecScan
which then callsFloat4Codec.PlanScan
but that only supports*float32
orFloat64Scanner
. I may be wrong about this as I'm not familiar with the code.As a workaround I've added
*float64
to(Float4Codec) PlanScan
and this appears to work OK. Happy to submit a PR but suspect this may have been excluded intentionally? e.g.The text was updated successfully, but these errors were encountered: