2
0

Fix sqlScannerWrapper NULL handling

https://github.com/jackc/pgx/issues/1312
This commit is contained in:
Jack Christensen
2022-09-24 10:29:44 -05:00
parent ac9d4f4d96
commit 335c8621ff
2 changed files with 13 additions and 7 deletions
+9 -7
View File
@@ -1921,13 +1921,15 @@ func (w *sqlScannerWrapper) Scan(src any) error {
}
var bufSrc []byte
switch src := src.(type) {
case string:
bufSrc = []byte(src)
case []byte:
bufSrc = src
default:
bufSrc = []byte(fmt.Sprint(bufSrc))
if src != nil {
switch src := src.(type) {
case string:
bufSrc = []byte(src)
case []byte:
bufSrc = src
default:
bufSrc = []byte(fmt.Sprint(bufSrc))
}
}
return w.m.Scan(t.OID, TextFormatCode, bufSrc, w.v)