From 45a8b00271664a5d2718c3fd7e69fda9ca429193 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Fri, 4 Mar 2022 11:04:46 -0600 Subject: [PATCH] Do not recursively call public PlanScan that caches Otherwise, wrapper types get cached. Wrapper types are expected to fail most of the time. These failures should not be cached. In addition, wrappers wrap multiple different types so it doesn't make sense to cache results of a wrapper. --- pgtype/pgtype.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pgtype/pgtype.go b/pgtype/pgtype.go index cb24f295..8c743163 100644 --- a/pgtype/pgtype.go +++ b/pgtype/pgtype.go @@ -1068,7 +1068,7 @@ func (m *Map) planScan(oid uint32, formatCode int16, target interface{}) ScanPla for _, f := range m.TryWrapScanPlanFuncs { if wrapperPlan, nextDst, ok := f(target); ok { - if nextPlan := m.PlanScan(oid, formatCode, nextDst); nextPlan != nil { + if nextPlan := m.planScan(oid, formatCode, nextDst); nextPlan != nil { if _, failed := nextPlan.(*scanPlanFail); !failed { wrapperPlan.SetNext(nextPlan) return wrapperPlan