Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: remove TimeTZ and Time Precision 19.2->20.1 gates #55562

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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