When a type defines a value receiver Value() method implementing database/sql's driver.Valuer interface, and nil is passed as a pointer to that type as a query parameter go-sql-spanner panics inside CheckNamedValue with an error of panic: value method github.com/googleapis/go-sql-spanner.ValuerNil.Value called using nil *CustomType pointer.
When a type defines a value receiver
Value()
method implementingdatabase/sql
'sdriver.Valuer
interface, and nil is passed as a pointer to that type as a query parametergo-sql-spanner
panics insideCheckNamedValue
with an error ofpanic: value method github.com/googleapis/go-sql-spanner.ValuerNil.Value called using nil *CustomType pointer
.This is a special case, however the
database/sql
package handles this case gracefully and if it detects this case will pass along nil as the value to the database. See https://github.com/golang/go/commit/0ce1d79a6a771f7449ec493b993ed2a720917870#diff-d55a0593e9a7f78d72c435734e71154a20e8c22feec63f09cfbf00e8ba498daeR211-R232/https://go-review.googlesource.com/c/go/+/31259 and https://github.com/golang/go/issues/8415 for discussion.