Skip to content

Commit 5b36e6e

Browse files
committed
handle nil values in type aware conversion
1 parent 2d2cb40 commit 5b36e6e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sql/types/conversion.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,9 @@ func GeneralizeTypes(a, b sql.Type) sql.Type {
737737
}
738738

739739
func TypeAwareConversion(ctx *sql.Context, val interface{}, originalType sql.Type, convertedType sql.Type) (interface{}, error) {
740+
if val == nil {
741+
return nil, nil
742+
}
740743
var converted interface{}
741744
var err error
742745
if IsTextOnly(convertedType) {

0 commit comments

Comments
 (0)