Skip to content

Commit f8a09a5

Browse files
craig[bot]paulniziolek
andcommitted
152285: sql: remove LTREE from mixed version clusters previous to 25.4 r=yuzefovich a=paulniziolek #### sql: remove LTREE from mixed version clusters previous to 25.4 Currently, we hit internal panics for randomized mixed version testing. This PR prevents this by blocking LTREE usage in mixed version clusters. Epic: None Release note: None Co-authored-by: Paul Niziolek <[email protected]>
2 parents a10bae0 + c859f00 commit f8a09a5

File tree

12 files changed

+92
-18
lines changed

12 files changed

+92
-18
lines changed

pkg/sql/catalog/colinfo/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ go_library(
1616
importpath = "github.com/cockroachdb/cockroach/pkg/sql/catalog/colinfo",
1717
visibility = ["//visibility:public"],
1818
deps = [
19+
"//pkg/clusterversion",
1920
"//pkg/docs",
2021
"//pkg/settings/cluster",
2122
"//pkg/sql/catalog",

pkg/sql/catalog/colinfo/col_type_info.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"context"
1010
"fmt"
1111

12+
"github.com/cockroachdb/cockroach/pkg/clusterversion"
1213
"github.com/cockroachdb/cockroach/pkg/docs"
1314
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
1415
"github.com/cockroachdb/cockroach/pkg/sql/catalog"
@@ -110,14 +111,21 @@ func ValidateColumnDefType(ctx context.Context, st *cluster.Settings, t *types.T
110111
types.INetFamily, types.IntervalFamily, types.JsonFamily, types.OidFamily, types.TimeFamily,
111112
types.TimestampFamily, types.TimestampTZFamily, types.UuidFamily, types.TimeTZFamily,
112113
types.GeographyFamily, types.GeometryFamily, types.EnumFamily, types.Box2DFamily,
113-
types.TSQueryFamily, types.TSVectorFamily, types.PGLSNFamily, types.PGVectorFamily, types.RefCursorFamily,
114-
types.LTreeFamily:
114+
types.TSQueryFamily, types.TSVectorFamily, types.PGLSNFamily, types.PGVectorFamily, types.RefCursorFamily:
115115
// These types are OK.
116116

117117
case types.JsonpathFamily:
118118
return unimplemented.NewWithIssueDetailf(144910, t.String(),
119119
"jsonpath unsupported as column type")
120120

121+
case types.LTreeFamily:
122+
if !st.Version.IsActive(ctx, clusterversion.V25_4) {
123+
return pgerror.Newf(
124+
pgcode.FeatureNotSupported,
125+
"ltree not supported until version 25.4",
126+
)
127+
}
128+
121129
case types.TupleFamily:
122130
if !t.UserDefined() {
123131
return pgerror.New(pgcode.InvalidTableDefinition, "cannot use anonymous record type as table column")

pkg/sql/logictest/testdata/logic_test/ltree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# LogicTest: !local-mixed-25.2 !local-mixed-25.3
2+
13
statement ok
24
CREATE TABLE l (lt LTREE);
35

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# LogicTest: cockroach-go-testserver-configs
2+
3+
# Sanity check that LTREE type is only allowed to be used once the cluster is
4+
# upgraded to 25.4.
5+
6+
statement error pgcode 42704 type \"ltree\" does not exist
7+
CREATE TABLE l (lt LTREE);
8+
9+
statement error pgcode 42704 type \"ltree\" does not exist
10+
CREATE TABLE la (lta LTREE[]);
11+
12+
statement error pgcode 42704 type \"ltree\" does not exist
13+
SELECT 'A.B'::LTREE
14+
15+
statement error pgcode 42704 type \"ltree\" does not exist
16+
SELECT ARRAY['A', 'A.B']::LTREE[]
17+
18+
upgrade 0
19+
20+
statement error pgcode 0A000 ltree not supported until version 25.4
21+
CREATE TABLE l (lt LTREE);
22+
23+
statement error pgcode 0A000 ltree not supported until version 25.4
24+
CREATE TABLE la (lta LTREE[]);
25+
26+
statement error pgcode 0A000 ltree not supported until version 25.4
27+
SELECT 'A.B'::LTREE
28+
29+
statement error pgcode 0A000 ltree\[\] not supported until version 25.4
30+
SELECT ARRAY['A', 'A.B']::LTREE[]
31+
32+
upgrade 1
33+
34+
upgrade 2
35+
36+
statement ok
37+
SET CLUSTER SETTING version = crdb_internal.node_executable_version()
38+
39+
statement ok
40+
CREATE TABLE l (lt LTREE);
41+
42+
statement ok
43+
CREATE TABLE la (lta LTREE[]);
44+
45+
statement ok
46+
SELECT 'A.B'::LTREE
47+
48+
statement ok
49+
SELECT ARRAY['A', 'A.B']::LTREE[]

pkg/sql/logictest/tests/cockroach-go-testserver-25.2/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ go_test(
1111
"//pkg/sql/logictest:testdata", # keep
1212
],
1313
exec_properties = {"test.Pool": "heavy"},
14-
shard_count = 8,
14+
shard_count = 9,
1515
tags = ["cpu:3"],
1616
deps = [
1717
"//pkg/base",

pkg/sql/logictest/tests/cockroach-go-testserver-25.2/generated_test.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/sql/logictest/tests/cockroach-go-testserver-25.3/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ go_test(
1111
"//pkg/sql/logictest:testdata", # keep
1212
],
1313
exec_properties = {"test.Pool": "heavy"},
14-
shard_count = 7,
14+
shard_count = 8,
1515
tags = ["cpu:3"],
1616
deps = [
1717
"//pkg/base",

pkg/sql/logictest/tests/cockroach-go-testserver-25.3/generated_test.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/sql/logictest/tests/local-mixed-25.2/generated_test.go

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/sql/logictest/tests/local-mixed-25.3/generated_test.go

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)