Skip to content

Commit 29ada93

Browse files
committed
skip generalizing type if two types are equal
1 parent 63cbe7d commit 29ada93

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

enginetest/queries/integration_plans.go

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

enginetest/queries/script_queries.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8730,7 +8730,8 @@ where
87308730
},
87318731
{
87328732
// https://github.com/dolthub/dolt/issues/9024
8733-
Name: "subqueries should coerce union types",
8733+
Name: "subqueries should coerce union types",
8734+
Dialect: "mysql",
87348735
SetUpScript: []string{
87358736
"create table enum_table (i int primary key, e enum('a','b'))",
87368737
"insert into enum_table values (1,'a'),(2,'b')",

sql/types/conversion.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package types
1616

1717
import (
1818
"fmt"
19+
"reflect"
1920
"strconv"
2021
"strings"
2122
"time"
@@ -635,7 +636,12 @@ func generalizeNumberTypes(a, b sql.Type) sql.Type {
635636
// GeneralizeTypes returns the more "general" of two types as defined by
636637
// https://dev.mysql.com/doc/refman/8.4/en/flow-control-functions.html
637638
// TODO: Create and handle "Illegal mix of collations" error
639+
// TODO: Handle extended types, like DoltgresType
638640
func GeneralizeTypes(a, b sql.Type) sql.Type {
641+
if reflect.DeepEqual(a, b) {
642+
return a
643+
}
644+
639645
if a == Null {
640646
return b
641647
}

0 commit comments

Comments
 (0)