agora inbox for [email protected]
help / color / mirror / Atom feed[PATCH v9 5/8] Invalidate parent indexes
98+ messages / 4 participants
[nested] [flat]
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v10 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..1b8ff911b0 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid, true);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a2af5c15ec..c316c41905 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -546,6 +546,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 3b7fa3142f..1cc7c1aaca 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -237,6 +237,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--mvpLiMfbWzRoNl4x
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v10-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v4 3/5] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 4f30174ba7..35beff6f9f 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -573,6 +573,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--Sr1nOIr3CvdE5hEN
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v4-0004-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v5 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 4f30174ba7..35beff6f9f 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -573,6 +573,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--/i8j2F0k9BYX4qLc
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v5-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index dd8014c206..8a2e66bbeb 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -598,6 +598,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--fmvA4kSBHQVZhkR6
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v9-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 78c2c2ba72..05c84e5582 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--AA9g+nFNFPYNJKiL
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v7-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 5/8] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5c08f0642e..60272bc010 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -600,6 +600,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index 1d436dfaae..6cba3cc4f9 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index 0ded2be1ca..a1d132f288 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--O5XBE6gyVG5Rl6Rj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0006-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 4/7] Invalidate parent indexes
@ 2020-11-06 00:58 Justin Pryzby <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Justin Pryzby @ 2020-11-06 00:58 UTC (permalink / raw)
---
src/backend/commands/cluster.c | 21 +++++++++++++++++++++
src/test/regress/expected/cluster.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/cluster.sql | 8 ++++++++
3 files changed, 55 insertions(+)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 078b97fbb9..cdb49985ce 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -594,6 +594,27 @@ mark_index_clustered(Relation rel, Oid indexOid, bool is_internal)
}
list_free(inh);
+ /*
+ * Set parent of all indexes as unclustered when a rel is unclustered; and,
+ * when an index is clustered, set parents of all /other/ indexes as
+ * unclustered.
+ */
+ indexes = RelationGetIndexList(rel);
+ foreach (lc, indexes)
+ {
+ Oid thisIndexOid = lfirst_oid(lc);
+
+ if (thisIndexOid == indexOid)
+ continue;
+
+ while (get_rel_relispartition(thisIndexOid))
+ {
+ thisIndexOid = get_partition_parent(thisIndexOid);
+ set_indisclustered(thisIndexOid, false, pg_index);
+ }
+ }
+ list_free(indexes);
+
table_close(pg_index, RowExclusiveLock);
}
diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out
index a9fb9f1021..6d88978387 100644
--- a/src/test/regress/expected/cluster.out
+++ b/src/test/regress/expected/cluster.out
@@ -541,6 +541,32 @@ Indexes:
"clstrpart1_idx_2" btree (a) CLUSTER
Number of partitions: 2 (Use \d+ to list them.)
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
+ Partitioned table "public.clstrpart"
+ Column | Type | Collation | Nullable | Default
+--------+---------+-----------+----------+---------
+ a | integer | | |
+Partition key: RANGE (a)
+Indexes:
+ "clstrpart_idx" btree (a)
+Number of partitions: 3 (Use \d+ to list them.)
+
-- Test CLUSTER with external tuplesorting
create table clstr_4 as select * from tenk1;
create index cluster_sort on clstr_4 (hundred, thousand, tenthous);
diff --git a/src/test/regress/sql/cluster.sql b/src/test/regress/sql/cluster.sql
index d15bd51496..c9bb204a93 100644
--- a/src/test/regress/sql/cluster.sql
+++ b/src/test/regress/sql/cluster.sql
@@ -231,6 +231,14 @@ CREATE INDEX clstrpart1_idx_2 ON clstrpart1(a);
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
ALTER TABLE clstrpart1 CLUSTER ON clstrpart1_idx_2;
\d clstrpart1
+-- Check that the parent index is marked not clustered after clustering a partition on a different index:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+CLUSTER clstrpart1 USING clstrpart1_idx_2;
+\d clstrpart
+-- Check that the parent index is marked not clustered after setting a partition not clustered:
+ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
+ALTER TABLE clstrpart1 SET WITHOUT CLUSTER;
+\d clstrpart
-- Test CLUSTER with external tuplesorting
--
2.17.0
--FsscpQKzF/jJk6ya
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v6-0005-Invalidate-parent-index-cluster-on-attach.patch"
^ permalink raw reply [nested|flat] 98+ messages in thread
* pg_dump not dumping the run_as_owner setting from version 16?
@ 2023-10-27 04:25 Philip Warner <[email protected]>
0 siblings, 1 reply; 98+ messages in thread
From: Philip Warner @ 2023-10-27 04:25 UTC (permalink / raw)
To: [email protected] <[email protected]>
Hi,
I as far as I can tell, pg_dump does not dup the ‘run_as_owner` setting for a subscription.
Should it? Should I submit a patch? It seems pretty trivial to fix if anyone else is working on it.
Sent from Mail for Windows
^ permalink raw reply [nested|flat] 98+ messages in thread
* RE: pg_dump not dumping the run_as_owner setting from version 16?
@ 2023-10-27 07:05 Philip Warner <[email protected]>
parent: Philip Warner <[email protected]>
0 siblings, 1 reply; 98+ messages in thread
From: Philip Warner @ 2023-10-27 07:05 UTC (permalink / raw)
To: [email protected] <[email protected]>
Further to this: it seems that `Alter Subscription X Set(Run_As_Owner=True);` has no influence on the `subrunasowner` column of pg_subscriptions.
Sent from Mail for Windows
From: Philip Warner
Sent: Friday, 27 October 2023 3:26 PM
To: [email protected]
Subject: pg_dump not dumping the run_as_owner setting from version 16?
Hi,
I as far as I can tell, pg_dump does not dup the ‘run_as_owner` setting for a subscription.
Should it? Should I submit a patch? It seems pretty trivial to fix if anyone else is working on it.
Sent from Mail for Windows
^ permalink raw reply [nested|flat] 98+ messages in thread
* Re: pg_dump not dumping the run_as_owner setting from version 16?
@ 2023-10-27 07:52 Laurenz Albe <[email protected]>
parent: Philip Warner <[email protected]>
0 siblings, 2 replies; 98+ messages in thread
From: Laurenz Albe @ 2023-10-27 07:52 UTC (permalink / raw)
To: Philip Warner <[email protected]>; [email protected] <[email protected]>
On Fri, 2023-10-27 at 18:05 +1100, Philip Warner wrote:
> I as far as I can tell, pg_dump does not dup the ‘run_as_owner` setting for a subscription.
>
> Should it? Should I submit a patch? It seems pretty trivial to fix if anyone else is working on it.
Yes, it certainly should. That is an omission in 482675987b.
Go ahead and write a fix!
> Further to this: it seems that `Alter Subscription X Set(Run_As_Owner=True);`
> has no influence on the `subrunasowner` column of pg_subscriptions.
This seems to have been fixed in f062cddafe.
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 98+ messages in thread
* RE: pg_dump not dumping the run_as_owner setting from version 16?
@ 2023-10-28 08:03 Philip Warner <[email protected]>
parent: Laurenz Albe <[email protected]>
1 sibling, 0 replies; 98+ messages in thread
From: Philip Warner @ 2023-10-28 08:03 UTC (permalink / raw)
To: Laurenz Albe <[email protected]>; [email protected] <[email protected]>
> > I as far as I can tell, pg_dump does not dup the ‘run_as_owner` setting for a subscription.
> >
> > Should it? Should I submit a patch? It seems pretty trivial to fix if anyone else is working on it.
>
> Yes, it certainly should. That is an omission in 482675987b.
> Go ahead and write a fix!
Please find attached a patch for pg_dump to honour the setting of `run_as_owner`; I believe that effective pre-16 behavious was to run as owner, so I have set the flag to ‘t’ for pre-16 versions. Please let me know if you would prefer the opposite.
> > Further to this: it seems that `Alter Subscription X Set(Run_As_Owner=True);`
> > has no influence on the `subrunasowner` column of pg_subscriptions.
>
> This seems to have been fixed in f062cddafe.
Yes, I can confirm that in the current head `pg_subscriptions` reflects the setting correctly.
^ permalink raw reply [nested|flat] 98+ messages in thread
* RE: pg_dump not dumping the run_as_owner setting from version 16?
@ 2023-10-28 08:54 Philip Warner <[email protected]>
parent: Laurenz Albe <[email protected]>
1 sibling, 1 reply; 98+ messages in thread
From: Philip Warner @ 2023-10-28 08:54 UTC (permalink / raw)
To: [email protected] <[email protected]>
...patch actually attached this time...
> > I as far as I can tell, pg_dump does not dup the ‘run_as_owner` setting for a subscription.
> >
> > Should it? Should I submit a patch? It seems pretty trivial to fix if anyone else is working on it.
>
> Yes, it certainly should. That is an omission in 482675987b.
> Go ahead and write a fix!
Please find attached a patch for pg_dump to honour the setting of `run_as_owner`; I believe that effective pre-16 behavious was to run as owner, so I have set the flag to ‘t’ for pre-16 versions. Please let me know if you would prefer the opposite.
> > Further to this: it seems that `Alter Subscription X Set(Run_As_Owner=True);`
> > has no influence on the `subrunasowner` column of pg_subscriptions.
>
> This seems to have been fixed in f062cddafe.
Yes, I can confirm that in the current head `pg_subscriptions` reflects the setting correctly.
Attachments:
[application/octet-stream] pg_dump-run_as_owner.patch (2.4K, ../../[email protected]/3-pg_dump-run_as_owner.patch)
download | inline diff:
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 7afdbf4d9d..ab657e5254 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -4600,6 +4600,7 @@ getSubscriptions(Archive *fout)
int i_subtwophasestate;
int i_subdisableonerr;
int i_suborigin;
+ int i_subrunasowner;
int i_subconninfo;
int i_subslotname;
int i_subsynccommit;
@@ -4660,10 +4661,12 @@ getSubscriptions(Archive *fout)
if (fout->remoteVersion >= 160000)
appendPQExpBufferStr(query,
" s.suborigin,\n"
+ " s.subrunasowner,\n"
" s.subpasswordrequired\n");
else
appendPQExpBuffer(query,
" '%s' AS suborigin,\n"
+ " 't' AS subrunasowner,\n"
" 't' AS subpasswordrequired\n",
LOGICALREP_ORIGIN_ANY);
@@ -4685,6 +4688,7 @@ getSubscriptions(Archive *fout)
i_subname = PQfnumber(res, "subname");
i_subowner = PQfnumber(res, "subowner");
i_subconninfo = PQfnumber(res, "subconninfo");
+ i_subrunasowner = PQfnumber(res, "subrunasowner");
i_subslotname = PQfnumber(res, "subslotname");
i_subsynccommit = PQfnumber(res, "subsynccommit");
i_subpublications = PQfnumber(res, "subpublications");
@@ -4707,6 +4711,7 @@ getSubscriptions(Archive *fout)
subinfo[i].dobj.name = pg_strdup(PQgetvalue(res, i, i_subname));
subinfo[i].rolname = getRoleName(PQgetvalue(res, i, i_subowner));
subinfo[i].subconninfo = pg_strdup(PQgetvalue(res, i, i_subconninfo));
+ subinfo[i].subrunasowner = pg_strdup(PQgetvalue(res, i, i_subrunasowner));
if (PQgetisnull(res, i, i_subslotname))
subinfo[i].subslotname = NULL;
else
@@ -4810,6 +4815,9 @@ dumpSubscription(Archive *fout, const SubscriptionInfo *subinfo)
if (strcmp(subinfo->subpasswordrequired, "t") != 0)
appendPQExpBuffer(query, ", password_required = false");
+ if (strcmp(subinfo->subrunasowner, "t") == 0)
+ appendPQExpBufferStr(query, ", run_as_owner = true");
+
appendPQExpBufferStr(query, ");\n");
if (subinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h
index d8f27f187c..bcba4a1ef0 100644
--- a/src/bin/pg_dump/pg_dump.h
+++ b/src/bin/pg_dump/pg_dump.h
@@ -661,6 +661,7 @@ typedef struct _SubscriptionInfo
DumpableObject dobj;
const char *rolname;
char *subconninfo;
+ char *subrunasowner;
char *subslotname;
char *subbinary;
char *substream;
^ permalink raw reply [nested|flat] 98+ messages in thread
* Re: pg_dump not dumping the run_as_owner setting from version 16?
@ 2023-10-29 16:57 Tom Lane <[email protected]>
parent: Philip Warner <[email protected]>
0 siblings, 0 replies; 98+ messages in thread
From: Tom Lane @ 2023-10-29 16:57 UTC (permalink / raw)
To: Philip Warner <[email protected]>; +Cc: [email protected] <[email protected]>
Philip Warner <[email protected]> writes:
> Please find attached a patch for pg_dump to honour the setting of `run_as_owner`; I believe that effective pre-16 behavious was to run as owner, so I have set the flag to ‘t’ for pre-16 versions. Please let me know if you would prefer the opposite.
I think that's the correct choice. Fix pushed, thanks.
regards, tom lane
^ permalink raw reply [nested|flat] 98+ messages in thread
end of thread, other threads:[~2023-10-29 16:57 UTC | newest]
Thread overview: 98+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v5 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v10 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v9 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v4 3/5] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v6 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v8 5/8] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2020-11-06 00:58 [PATCH v7 4/7] Invalidate parent indexes Justin Pryzby <[email protected]>
2023-10-27 04:25 pg_dump not dumping the run_as_owner setting from version 16? Philip Warner <[email protected]>
2023-10-27 07:05 ` RE: pg_dump not dumping the run_as_owner setting from version 16? Philip Warner <[email protected]>
2023-10-27 07:52 ` Re: pg_dump not dumping the run_as_owner setting from version 16? Laurenz Albe <[email protected]>
2023-10-28 08:03 ` RE: pg_dump not dumping the run_as_owner setting from version 16? Philip Warner <[email protected]>
2023-10-28 08:54 ` RE: pg_dump not dumping the run_as_owner setting from version 16? Philip Warner <[email protected]>
2023-10-29 16:57 ` Re: pg_dump not dumping the run_as_owner setting from version 16? Tom Lane <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox