Skip to content

Commit 95d8ed1

Browse files
committed
Fixes for type corruption in case statements
1 parent cf84c90 commit 95d8ed1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sql/types/conversion.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,10 @@ func GeneralizeTypes(a, b sql.Type) sql.Type {
642642
if b == Null {
643643
return a
644644
}
645+
646+
if a == b {
647+
return a
648+
}
645649

646650
if svt, ok := a.(sql.SystemVariableType); ok {
647651
a = svt.UnderlyingType()
@@ -716,6 +720,11 @@ func GeneralizeTypes(a, b sql.Type) sql.Type {
716720
if IsNumber(a) && IsNumber(b) {
717721
return generalizeNumberTypes(a, b)
718722
}
723+
724+
if IsText(a) || IsText(b) {
725+
return a
726+
}
727+
719728
// TODO: decide if we want to make this VarChar to match MySQL, match VarChar length to max of two types
720729
return LongText
721730
}

0 commit comments

Comments
 (0)