prevent creating indexes using spatial types

This commit is contained in:
James Cor
2022-02-01 11:24:47 -08:00
parent 59a8608ad3
commit 2bc7b71f28

View File

@@ -16,6 +16,7 @@ package schema
import (
"fmt"
"github.com/dolthub/dolt/go/libraries/doltcore/schema/typeinfo"
"sort"
"strings"
)
@@ -144,6 +145,14 @@ func (ixc *indexCollectionImpl) AddIndexByColTags(indexName string, tags []uint6
if ixc.hasIndexOnTags(tags...) {
return nil, fmt.Errorf("cannot create a duplicate index on this table")
}
for _, c := range ixc.colColl.cols {
if c.TypeInfo.Equals(typeinfo.PointType) ||
c.TypeInfo.Equals(typeinfo.LinestringType) ||
c.TypeInfo.Equals(typeinfo.PolygonType) {
return nil, fmt.Errorf("cannot create an index over spatial type columns")
}
}
index := &indexImpl{
indexColl: ixc,
name: indexName,