Skip to content

Commit

Permalink
sql: gate Geospatial features under version gate
Browse files Browse the repository at this point in the history
Prevent the creation of Geospatial types until a version upgrade is
complete. Re-using the 19.2-20.1 mixed cluster tests for now to test
this.

Release note: None
  • Loading branch information
otan committed Apr 22, 2020
1 parent a1296f9 commit 661fbbc
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/generated/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@
<tr><td><code>trace.debug.enable</code></td><td>boolean</td><td><code>false</code></td><td>if set, traces for recent requests can be seen in the /debug page</td></tr>
<tr><td><code>trace.lightstep.token</code></td><td>string</td><td><code></code></td><td>if set, traces go to Lightstep using this token</td></tr>
<tr><td><code>trace.zipkin.collector</code></td><td>string</td><td><code></code></td><td>if set, traces go to the given Zipkin instance (example: '127.0.0.1:9411'); ignored if trace.lightstep.token is set</td></tr>
<tr><td><code>version</code></td><td>custom validation</td><td><code>20.1-1</code></td><td>set the active cluster version in the format '<major>.<minor>'</td></tr>
<tr><td><code>version</code></td><td>custom validation</td><td><code>20.1-2</code></td><td>set the active cluster version in the format '<major>.<minor>'</td></tr>
</tbody>
</table>
6 changes: 6 additions & 0 deletions pkg/clusterversion/cockroach_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const (
VersionTimePrecision
Version20_1
VersionStart20_2
VersionGeospatialType

// Add new versions here (step one of two).
)
Expand Down Expand Up @@ -468,6 +469,11 @@ var versionsSingleton = keyedVersions([]keyedVersion{
Key: VersionStart20_2,
Version: roachpb.Version{Major: 20, Minor: 1, Unstable: 1},
},
{
// VersionGeospatialType enables the use of Geospatial features.
Key: VersionGeospatialType,
Version: roachpb.Version{Major: 20, Minor: 1, Unstable: 2},
},

// Add new versions here (step two of two).

Expand Down
5 changes: 3 additions & 2 deletions pkg/clusterversion/versionkey_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkg/sql/create_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ var storageParamExpectedTypes = map[string]storageParamType{
// minimumTypeUsageVersions defines the minimum version needed for a new
// data type.
var minimumTypeUsageVersions = map[types.Family]clusterversion.VersionKey{
types.TimeTZFamily: clusterversion.VersionTimeTZType,
types.TimeTZFamily: clusterversion.VersionTimeTZType,
types.GeographyFamily: clusterversion.VersionGeospatialType,
types.GeometryFamily: clusterversion.VersionGeospatialType,
}

// isTypeSupportedInVersion returns whether a given type is supported in the given version.
Expand Down
13 changes: 13 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/alter_table_mixed_19.2_20.1
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,16 @@ CREATE TABLE regression_47110_not_ok(interval_not_ok INTERVAL(3))

statement error type INTERVAL DAY is not supported until version upgrade is finalized
CREATE TABLE regression_47110_not_ok(interval_not_ok INTERVAL DAY)

# TODO(otan): move this to mixed 20.1-20.2 tests when available.
statement error type GEOMETRY is not supported until version upgrade is finalized
CREATE TABLE geo_test(a GEOMETRY)

statement error type GEOGRAPHY.* is not supported until version upgrade is finalized
CREATE TABLE geo_test(a GEOGRAPHY)

statement error type GEOMETRY is not supported until version upgrade is finalized
ALTER TABLE t ADD COLUMN geo GEOMETRY

statement error type GEOGRAPHY.* is not supported until version upgrade is finalized
ALTER TABLE t ADD COLUMN geo GEOGRAPHY

0 comments on commit 661fbbc

Please sign in to comment.