From f3f1313d885f5dc9d6daa8afdbcecae319849fff Mon Sep 17 00:00:00 2001 From: Jesse Seldess Date: Wed, 23 Aug 2017 22:12:13 -0400 Subject: [PATCH] Add known limitation around dropping interleaved indexes --- v1.0/known-limitations.md | 60 +++++++++++++++++++++++++++++++++++++++ v1.1/known-limitations.md | 60 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) diff --git a/v1.0/known-limitations.md b/v1.0/known-limitations.md index 14cf448a478..6028d2f6639 100644 --- a/v1.0/known-limitations.md +++ b/v1.0/known-limitations.md @@ -280,3 +280,63 @@ Also, a prepared [`INSERT`](insert.html), [`UPSERT`](upsert.html), or [`DELETE`] - If the number of columns has increased, the prepared statement returns an error but nonetheless writes the data. - If the number of columns remains the same but the types have changed, the prepared statement writes the data and does not return an error. + +## Dropping an index interleaved into another index on the same table + +In the unlikely case that you [interleave](interleave-in-parent.html) an index into another index on the same table and then [drop](drop-index.html) the interleaved index, future DDL operations on the table will fail. + +For example: + +~~~ sql +> CREATE TABLE t1 (id1 INT PRIMARY KEY, id2 INT, id3 INT); +~~~ + +~~~ sql +> CREATE INDEX c ON t1 (id2) + STORING (id1, id3) + INTERLEAVE IN PARENT t1 (id2); +~~~ + +~~~ sql +> SHOW INDEXES FROM t1; +~~~ + +~~~ ++-------+---------+--------+-----+--------+-----------+---------+----------+ +| Table | Name | Unique | Seq | Column | Direction | Storing | Implicit | ++-------+---------+--------+-----+--------+-----------+---------+----------+ +| t1 | primary | true | 1 | id1 | ASC | false | false | +| t1 | c | false | 1 | id2 | ASC | false | false | +| t1 | c | false | 2 | id1 | N/A | true | false | +| t1 | c | false | 3 | id3 | N/A | true | false | ++-------+---------+--------+-----+--------+-----------+---------+----------+ +(4 rows) +~~~ + +~~~ sql +> DROP INDEX t1@c; +~~~ + +~~~ sql +> DROP TABLE t1; +~~~ + +~~~ +pq: invalid interleave backreference table=t1 index=3: index-id "3" does not exist +~~~ + +~~~ sql +> TRUNCATE TABLE t1; +~~~ + +~~~ +pq: invalid interleave backreference table=t1 index=3: index-id "3" does not exist +~~~ + +~~~ sql +> ALTER TABLE t1 RENAME COLUMN id3 TO id4; +~~~ + +~~~ +pq: invalid interleave backreference table=t1 index=3: index-id "3" does not exist +~~~ diff --git a/v1.1/known-limitations.md b/v1.1/known-limitations.md index 8d0be283c06..c9fbfa6a059 100644 --- a/v1.1/known-limitations.md +++ b/v1.1/known-limitations.md @@ -201,3 +201,63 @@ Also, a prepared [`INSERT`](insert.html), [`UPSERT`](upsert.html), or [`DELETE`] - If the number of columns has increased, the prepared statement returns an error but nonetheless writes the data. - If the number of columns remains the same but the types have changed, the prepared statement writes the data and does not return an error. + +## Dropping an index interleaved into another index on the same table + +In the unlikely case that you [interleave](interleave-in-parent.html) an index into another index on the same table and then [drop](drop-index.html) the interleaved index, future DDL operations on the table will fail. + +For example: + +~~~ sql +> CREATE TABLE t1 (id1 INT PRIMARY KEY, id2 INT, id3 INT); +~~~ + +~~~ sql +> CREATE INDEX c ON t1 (id2) + STORING (id1, id3) + INTERLEAVE IN PARENT t1 (id2); +~~~ + +~~~ sql +> SHOW INDEXES FROM t1; +~~~ + +~~~ ++-------+---------+--------+-----+--------+-----------+---------+----------+ +| Table | Name | Unique | Seq | Column | Direction | Storing | Implicit | ++-------+---------+--------+-----+--------+-----------+---------+----------+ +| t1 | primary | true | 1 | id1 | ASC | false | false | +| t1 | c | false | 1 | id2 | ASC | false | false | +| t1 | c | false | 2 | id1 | N/A | true | false | +| t1 | c | false | 3 | id3 | N/A | true | false | ++-------+---------+--------+-----+--------+-----------+---------+----------+ +(4 rows) +~~~ + +~~~ sql +> DROP INDEX t1@c; +~~~ + +~~~ sql +> DROP TABLE t1; +~~~ + +~~~ +pq: invalid interleave backreference table=t1 index=3: index-id "3" does not exist +~~~ + +~~~ sql +> TRUNCATE TABLE t1; +~~~ + +~~~ +pq: invalid interleave backreference table=t1 index=3: index-id "3" does not exist +~~~ + +~~~ sql +> ALTER TABLE t1 RENAME COLUMN id3 TO id4; +~~~ + +~~~ +pq: invalid interleave backreference table=t1 index=3: index-id "3" does not exist +~~~