mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-20 11:22:31 -05:00
blocking in old format and adding test
This commit is contained in:
@@ -17,6 +17,7 @@ package encoding
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/dolthub/dolt/go/libraries/doltcore/schema"
|
||||
@@ -349,6 +350,14 @@ func MarshalSchemaAsNomsValue(ctx context.Context, vrw types.ValueReadWriter, sc
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if vrw.Format().VersionString() != types.Format_DOLT.VersionString() {
|
||||
for _, idx := range sch.Indexes().AllIndexes() {
|
||||
if idx.IsSpatial() {
|
||||
return nil, fmt.Errorf("spatial indexes are only supported in storage format __DOLT__")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if vrw.Format().UsesFlatbuffers() {
|
||||
return SerializeSchema(ctx, vrw, sch)
|
||||
}
|
||||
@@ -423,6 +432,14 @@ func UnmarshalSchemaNomsValue(ctx context.Context, nbf *types.NomsBinFormat, sch
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if nbf.VersionString() != types.Format_DOLT.VersionString() {
|
||||
for _, idx := range sch.Indexes().AllIndexes() {
|
||||
if idx.IsSpatial() {
|
||||
return nil, fmt.Errorf("spatial indexes are only supported in storage format __DOLT__")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if sd.PkOrdinals == nil {
|
||||
// schemaData will not have PK ordinals in old versions of Dolt
|
||||
// this sets the default PK ordinates for subsequent cache lookups
|
||||
|
||||
@@ -19,4 +19,12 @@ teardown() {
|
||||
@test "spatial-index: spatial indexes enabled" {
|
||||
DOLT_ENABLE_SPATIAL_INDEX=1 run dolt sql -q "create table t (p point srid 0 not null, spatial index(p))"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "spatial index: not supported in old format" {
|
||||
rm -rf .dolt
|
||||
dolt init --old-format
|
||||
DOLT_ENABLE_SPATIAL_INDEX=1 run dolt sql -q "create table t (p point srid 0 not null, spatial index(p))"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "spatial indexes are only supported in storage format" ]] || false
|
||||
}
|
||||
Reference in New Issue
Block a user