Skip to content

Commit fa1bcd7

Browse files
committed
Comparing type directly to types.TextType, instead of relying on Type.Type() returning sqltype.TEXT (since many other extended types return sqltypes.TEXT)
1 parent 08b7ce7 commit fa1bcd7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

server/analyzer/add_implicit_prefix_lengths.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import (
2222
"github.com/dolthub/go-mysql-server/sql/analyzer"
2323
"github.com/dolthub/go-mysql-server/sql/plan"
2424
"github.com/dolthub/go-mysql-server/sql/transform"
25-
"github.com/dolthub/vitess/go/sqltypes"
25+
26+
"github.com/dolthub/doltgresql/server/types"
2627
)
2728

2829
// defaultIndexPrefixLength is the index prefix length that this analyzer rule applies automatically to TEXT columns
@@ -71,7 +72,7 @@ func AddImplicitPrefixLengths(_ *sql.Context, _ *analyzer.Analyzer, node sql.Nod
7172
if !ok {
7273
return nil, false, fmt.Errorf("indexed column %s not found in schema", index.Columns[i].Name)
7374
}
74-
if col.Type.Type() == sqltypes.Text && index.Columns[i].Length == 0 {
75+
if _, ok := col.Type.(types.TextType); ok && index.Columns[i].Length == 0 {
7576
index.Columns[i].Length = defaultIndexPrefixLength
7677
indexModified = true
7778
}
@@ -96,7 +97,7 @@ func AddImplicitPrefixLengths(_ *sql.Context, _ *analyzer.Analyzer, node sql.Nod
9697
if !ok {
9798
return nil, false, fmt.Errorf("indexed column %s not found in schema", newColumns[i].Name)
9899
}
99-
if col.Type.Type() == sqltypes.Text && newColumns[i].Length == 0 {
100+
if _, ok := col.Type.(types.TextType); ok && newColumns[i].Length == 0 {
100101
newColumns[i].Length = defaultIndexPrefixLength
101102
indexModified = true
102103
}

0 commit comments

Comments
 (0)