Skip to content

Commit

Permalink
Merge pull request cockroachdb#61422 from mgartner/backport20.2-61106
Browse files Browse the repository at this point in the history
release-20.2: sql: disallow creation of interleaved partitioned indexes
  • Loading branch information
mgartner authored Mar 4, 2021
2 parents fff4372 + 0849f86 commit 91d3444
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/ccl/logictestccl/testdata/logic_test/partitioning_index
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,14 @@ CREATE TABLE public.t60019 (
FAMILY fam_0_pk_a_b (pk, a, b)
)
-- Warning: Partitioned table with no zone configurations.

# Regression test for #60699. Do not allow creation of interleaved partitioned
# indexes.
statement ok
CREATE TABLE t60699_a (a INT PRIMARY KEY);
CREATE TABLE t60699_b (b INT PRIMARY KEY, a INT REFERENCES t60699_a (a));

statement error interleaved indexes cannot be partitioned
CREATE INDEX i ON t60699_b (a) INTERLEAVE IN PARENT t60699_a (a) PARTITION BY LIST (a) (
partition part1 VALUES IN (1)
)
4 changes: 4 additions & 0 deletions pkg/sql/create_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@ func (n *createIndexNode) startExec(params runParams) error {
)
}

if n.n.Interleave != nil && n.n.PartitionBy != nil {
return pgerror.New(pgcode.FeatureNotSupported, "interleaved indexes cannot be partitioned")
}

indexDesc, err := MakeIndexDescriptor(params, n.n, n.tableDesc)
if err != nil {
return err
Expand Down

0 comments on commit 91d3444

Please sign in to comment.