From 2c69b6a82469d2b5de8fd5e6d4976bf258207ed5 Mon Sep 17 00:00:00 2001 From: Oliver Tan Date: Wed, 14 Oct 2020 14:50:49 -0700 Subject: [PATCH] sql: remove TimeTZ and Time Precision 19.2->20.1 gates Release note: None --- pkg/sql/create_table.go | 16 ------------- pkg/sql/create_table_test.go | 45 +----------------------------------- 2 files changed, 1 insertion(+), 60 deletions(-) diff --git a/pkg/sql/create_table.go b/pkg/sql/create_table.go index 5c2517d6907c..2682547fba3a 100644 --- a/pkg/sql/create_table.go +++ b/pkg/sql/create_table.go @@ -81,7 +81,6 @@ type createTableRun struct { // minimumTypeUsageVersions defines the minimum version needed for a new // data type. var minimumTypeUsageVersions = map[types.Family]clusterversion.VersionKey{ - types.TimeTZFamily: clusterversion.VersionTimeTZType, types.GeographyFamily: clusterversion.VersionGeospatialType, types.GeometryFamily: clusterversion.VersionGeospatialType, types.Box2DFamily: clusterversion.VersionBox2DType, @@ -95,21 +94,6 @@ func isTypeSupportedInVersion(v clusterversion.ClusterVersion, t *types.T) (bool t = t.ArrayContents() } - switch t.Family() { - case types.TimeFamily, types.TimestampFamily, types.TimestampTZFamily, types.TimeTZFamily: - if t.Precision() != 6 && !v.IsActive(clusterversion.VersionTimePrecision) { - return false, nil - } - case types.IntervalFamily: - itm, err := t.IntervalTypeMetadata() - if err != nil { - return false, err - } - if (t.Precision() != 6 || itm.DurationField != types.IntervalDurationField{}) && - !v.IsActive(clusterversion.VersionTimePrecision) { - return false, nil - } - } minVersion, ok := minimumTypeUsageVersions[t.Family()] if !ok { return true, nil diff --git a/pkg/sql/create_table_test.go b/pkg/sql/create_table_test.go index 658a3e2a33bd..436370540c6a 100644 --- a/pkg/sql/create_table_test.go +++ b/pkg/sql/create_table_test.go @@ -31,50 +31,7 @@ func TestIsTypeSupportedInVersion(t *testing.T) { ok bool }{ - {clusterversion.Version19_2, types.Time, true}, - {clusterversion.Version19_2, types.Timestamp, true}, - {clusterversion.Version19_2, types.Interval, true}, - - {clusterversion.Version19_2, types.TimeTZ, false}, - {clusterversion.VersionTimeTZType, types.TimeTZ, true}, - - {clusterversion.Version19_2, types.MakeTime(0), false}, - {clusterversion.Version19_2, types.MakeTimeTZ(0), false}, - {clusterversion.VersionTimeTZType, types.MakeTimeTZ(0), false}, - {clusterversion.Version19_2, types.MakeTimestamp(0), false}, - {clusterversion.Version19_2, types.MakeTimestampTZ(0), false}, - { - clusterversion.Version19_2, - types.MakeInterval(types.IntervalTypeMetadata{Precision: 3, PrecisionIsSet: true}), - false, - }, - { - clusterversion.Version19_2, - types.MakeInterval( - types.IntervalTypeMetadata{ - DurationField: types.IntervalDurationField{DurationType: types.IntervalDurationType_SECOND}, - }, - ), - false, - }, - {clusterversion.VersionTimePrecision, types.MakeTime(0), true}, - {clusterversion.VersionTimePrecision, types.MakeTimeTZ(0), true}, - {clusterversion.VersionTimePrecision, types.MakeTimestamp(0), true}, - {clusterversion.VersionTimePrecision, types.MakeTimestampTZ(0), true}, - { - clusterversion.VersionTimePrecision, - types.MakeInterval(types.IntervalTypeMetadata{Precision: 3, PrecisionIsSet: true}), - true, - }, - { - clusterversion.VersionTimePrecision, - types.MakeInterval( - types.IntervalTypeMetadata{ - DurationField: types.IntervalDurationField{DurationType: types.IntervalDurationType_SECOND}, - }, - ), - true, - }, + {clusterversion.VersionGeospatialType, types.Geometry, true}, } for _, tc := range testCases {