Skip to content

Commit 7bc5fe7

Browse files
committed
Limiting to only TEXT types
1 parent e5f05fc commit 7bc5fe7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/analyzer/add_implicit_prefix_lengths.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ package analyzer
1616

1717
import (
1818
"fmt"
19-
"github.com/dolthub/go-mysql-server/sql/analyzer"
2019
"strings"
2120

2221
"github.com/dolthub/go-mysql-server/sql"
22+
"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/go-mysql-server/sql/types"
25+
"github.com/dolthub/vitess/go/sqltypes"
2626
)
2727

2828
// defaultIndexPrefixLength is the index prefix length that this analyzer rule applies automatically to TEXT columns
@@ -71,7 +71,7 @@ func AddImplicitPrefixLengths(_ *sql.Context, _ *analyzer.Analyzer, node sql.Nod
7171
if !ok {
7272
return nil, false, fmt.Errorf("indexed column %s not found in schema", index.Columns[i].Name)
7373
}
74-
if types.IsText(col.Type) && index.Columns[i].Length == 0 {
74+
if col.Type.Type() == sqltypes.Text && index.Columns[i].Length == 0 {
7575
index.Columns[i].Length = defaultIndexPrefixLength
7676
indexModified = true
7777
}
@@ -96,7 +96,7 @@ func AddImplicitPrefixLengths(_ *sql.Context, _ *analyzer.Analyzer, node sql.Nod
9696
if !ok {
9797
return nil, false, fmt.Errorf("indexed column %s not found in schema", newColumns[i].Name)
9898
}
99-
if types.IsText(col.Type) && newColumns[i].Length == 0 {
99+
if col.Type.Type() == sqltypes.Text && newColumns[i].Length == 0 {
100100
newColumns[i].Length = defaultIndexPrefixLength
101101
indexModified = true
102102
}

0 commit comments

Comments
 (0)