Skip to content

Commit

Permalink
sql: remove TimeTZ and Time Precision 19.2->20.1 gates
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
otan committed Oct 14, 2020
1 parent 3cceec6 commit 2c69b6a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 60 deletions.
16 changes: 0 additions & 16 deletions pkg/sql/create_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
45 changes: 1 addition & 44 deletions pkg/sql/create_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2c69b6a

Please sign in to comment.