public inbox for [email protected]help / color / mirror / Atom feed
[PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes 98+ messages / 3 participants [nested] [flat]
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v10 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index a628b3281c..8e97d88c32 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -615,7 +615,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index 846975fc06..9429482980 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -586,6 +586,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ee14e7079f..af0849904d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -250,6 +250,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --mvpLiMfbWzRoNl4x Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v10-0008-pg_dump-partitioned-index-depend-on-its-partitio.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v1 2/3] preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 11 +++++++++++ src/test/regress/sql/cluster.sql | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 3ce6eb61d5..92ca0927fa 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -601,7 +601,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e4448350e7..8f245da46d 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -495,6 +495,17 @@ Indexes: "clstrpart_idx" btree (a) CLUSTER Number of partitions: 3 (Use \d+ to list them.) +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + +DROP TABLE clstrpart; -- 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 22225dc924..b871ab53c3 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -220,6 +220,9 @@ CLUSTER clstrpart1 USING clstrpart1_a_idx; -- partition which is itself partitio CLUSTER clstrpart12 USING clstrpart12_a_idx; -- partition which is itself partitioned, no childs CLUSTER clstrpart2 USING clstrpart2_a_idx; -- leaf \d clstrpart +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 +DROP TABLE clstrpart; -- Test CLUSTER with external tuplesorting -- 2.17.0 --8Tx+BDMK09J610+l Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0003-Invalidate-indisclustered-when-attaching-uncluste.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v3 2/3] preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 11 +++++++++++ src/test/regress/sql/cluster.sql | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 5ec225abe1..55d429971f 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e4448350e7..8f245da46d 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -495,6 +495,17 @@ Indexes: "clstrpart_idx" btree (a) CLUSTER Number of partitions: 3 (Use \d+ to list them.) +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + +DROP TABLE clstrpart; -- 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 22225dc924..b871ab53c3 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -220,6 +220,9 @@ CLUSTER clstrpart1 USING clstrpart1_a_idx; -- partition which is itself partitio CLUSTER clstrpart12 USING clstrpart12_a_idx; -- partition which is itself partitioned, no childs CLUSTER clstrpart2 USING clstrpart2_a_idx; -- leaf \d clstrpart +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 +DROP TABLE clstrpart; -- Test CLUSTER with external tuplesorting -- 2.17.0 --EDJsL2R9iCFAt7IV Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v3-0003-Propogate-changes-to-indisclustered-to-child-pare.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v4 5/5] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index d1e120e5ae..af1565ec4c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --Sr1nOIr3CvdE5hEN-- ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v5 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 731610c701..122c63c415 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --/i8j2F0k9BYX4qLc-- ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1cb9172a5f..3611da45e6 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --AA9g+nFNFPYNJKiL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 1514937748..08fdf02ebc 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --O5XBE6gyVG5Rl6Rj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v8-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 2 +- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index b8cd35e995..e15fb42c9c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -603,7 +603,7 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index f0c962db75..fc642f87d2 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 ff7ffed6e4..5df338f60d 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --FsscpQKzF/jJk6ya Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0007-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes @ 2020-10-07 01:40 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Justin Pryzby @ 2020-10-07 01:40 UTC (permalink / raw) Note, this takes a parentIndex, but that wasn't previously used ... UpdateIndexRelation(Oid indexoid, Oid heapoid, Oid parentIndexId, --- src/backend/catalog/index.c | 3 ++- src/test/regress/expected/cluster.out | 12 ++++++++++++ src/test/regress/sql/cluster.sql | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 4ef61b5efd..71649b38ee 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -604,7 +604,8 @@ UpdateIndexRelation(Oid indexoid, values[Anum_pg_index_indisprimary - 1] = BoolGetDatum(primary); values[Anum_pg_index_indisexclusion - 1] = BoolGetDatum(isexclusion); values[Anum_pg_index_indimmediate - 1] = BoolGetDatum(immediate); - values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(false); + values[Anum_pg_index_indisclustered - 1] = BoolGetDatum(OidIsValid(parentIndexId) && + get_index_isclustered(parentIndexId)); values[Anum_pg_index_indisvalid - 1] = BoolGetDatum(isvalid); values[Anum_pg_index_indcheckxmin - 1] = BoolGetDatum(false); values[Anum_pg_index_indisready - 1] = BoolGetDatum(isready); diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index e7f0889743..a3943c13f5 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -581,6 +581,18 @@ Indexes: "clstrpart_idx" btree (a) Number of partitions: 4 (Use \d+ to list them.) +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 + Table "public.clstrpart4" + Column | Type | Collation | Nullable | Default +--------+---------+-----------+----------+--------- + a | integer | | | +Partition of: clstrpart FOR VALUES FROM (30) TO (40) +Indexes: + "clstrpart4_a_idx" btree (a) CLUSTER + -- 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 3c8085c69e..22628e90ca 100644 --- a/src/test/regress/sql/cluster.sql +++ b/src/test/regress/sql/cluster.sql @@ -244,6 +244,10 @@ ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; CREATE TABLE clstrpart5 (LIKE clstrpart INCLUDING INDEXES); ALTER TABLE clstrpart ATTACH PARTITION clstrpart5 FOR VALUES FROM (40)TO(50); \d clstrpart +-- Check that new children inherit clustered mark +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CREATE TABLE clstrpart4 PARTITION OF clstrpart FOR VALUES FROM (30)TO(40); +\d clstrpart4 -- Test CLUSTER with external tuplesorting -- 2.17.0 --fmvA4kSBHQVZhkR6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0008-pg_dump-partitioned-index-depend-on-its-partition.patch" ^ permalink raw reply [nested|flat] 98+ messages in thread
* moving some code out of explain.c @ 2025-02-18 18:04 Robert Haas <[email protected]> 0 siblings, 1 reply; 98+ messages in thread From: Robert Haas @ 2025-02-18 18:04 UTC (permalink / raw) To: PostgreSQL Hackers <[email protected]> While contemplating some additions to explain.c, I noticed that this file has become rather large -- 5924 lines on master. I'm generally not a fan of very large source files, and I think it would be a good idea to start splitting this one up before things get completely out of control. Here are a few patches to move some chunks of code to separate files (explain_format.c and explain_dr.c). I think in cases like this there is a tendency to want to achieve an even split of the original file, but in practice I think that tends not to be difficult to achieve. These two patches combined move about 1000 lines of code into separate files, which I think is actually quite a good result for a refactoring of this sort. We might want to split it up even more, but I don't feel like that has to be done in the first set of patches or that all such patches have to come from me. So I propose to do just this much for now. Comments? -- Robert Haas EDB: http://www.enterprisedb.com Attachments: [application/octet-stream] v1-0001-Create-explain_format.c-and-move-relevant-code-th.patch (46.0K, ../../CA+TgmoYutMw1Jgo8BWUmB3TqnOhsEAJiYO=rOQufF4gPLWmkLQ@mail.gmail.com/2-v1-0001-Create-explain_format.c-and-move-relevant-code-th.patch) download | inline diff: From f1370c55370652daf05d27d848578708b8fc0001 Mon Sep 17 00:00:00 2001 From: Robert Haas <[email protected]> Date: Mon, 17 Feb 2025 12:22:23 -0500 Subject: [PATCH v1 1/2] Create explain_format.c and move relevant code there. explain.c has grown rather large, so move various functions that are principally concerned with output generation to a new source file, explain_format.c, instead of lumping them in with everything else that is part of explain.c --- contrib/auto_explain/auto_explain.c | 1 + contrib/file_fdw/file_fdw.c | 1 + contrib/postgres_fdw/postgres_fdw.c | 1 + src/backend/commands/Makefile | 1 + src/backend/commands/explain.c | 704 +------------------------ src/backend/commands/explain_format.c | 713 ++++++++++++++++++++++++++ src/backend/commands/meson.build | 1 + src/backend/commands/prepare.c | 1 + src/include/commands/explain.h | 24 - src/include/commands/explain_format.h | 52 ++ 10 files changed, 772 insertions(+), 727 deletions(-) create mode 100644 src/backend/commands/explain_format.c create mode 100644 src/include/commands/explain_format.h diff --git a/contrib/auto_explain/auto_explain.c b/contrib/auto_explain/auto_explain.c index f1ad876e821..1d33aac3797 100644 --- a/contrib/auto_explain/auto_explain.c +++ b/contrib/auto_explain/auto_explain.c @@ -16,6 +16,7 @@ #include "access/parallel.h" #include "commands/explain.h" +#include "commands/explain_format.h" #include "common/pg_prng.h" #include "executor/instrument.h" #include "utils/guc.h" diff --git a/contrib/file_fdw/file_fdw.c b/contrib/file_fdw/file_fdw.c index 0655bf532a0..bf707c812ed 100644 --- a/contrib/file_fdw/file_fdw.c +++ b/contrib/file_fdw/file_fdw.c @@ -25,6 +25,7 @@ #include "commands/copyfrom_internal.h" #include "commands/defrem.h" #include "commands/explain.h" +#include "commands/explain_format.h" #include "commands/vacuum.h" #include "foreign/fdwapi.h" #include "foreign/foreign.h" diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index b92e2a0fc9f..cd89706de3b 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -20,6 +20,7 @@ #include "catalog/pg_opfamily.h" #include "commands/defrem.h" #include "commands/explain.h" +#include "commands/explain_format.h" #include "executor/execAsync.h" #include "foreign/fdwapi.h" #include "funcapi.h" diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile index 48f7348f91c..04e406fb7cf 100644 --- a/src/backend/commands/Makefile +++ b/src/backend/commands/Makefile @@ -34,6 +34,7 @@ OBJS = \ dropcmds.o \ event_trigger.o \ explain.o \ + explain_format.o \ extension.o \ foreigncmds.o \ functioncmds.o \ diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index dc4bef9ab81..a6c214b6a51 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -17,6 +17,7 @@ #include "catalog/pg_type.h" #include "commands/createas.h" #include "commands/defrem.h" +#include "commands/explain_format.h" #include "commands/prepare.h" #include "foreign/fdwapi.h" #include "jit/jit.h" @@ -57,12 +58,6 @@ typedef struct SerializeMetrics BufferUsage bufferUsage; /* buffers accessed during serialization */ } SerializeMetrics; -/* OR-able flags for ExplainXMLTag() */ -#define X_OPENING 0 -#define X_CLOSING 1 -#define X_CLOSE_IMMEDIATE 2 -#define X_NOWHITESPACE 4 - /* * Various places within need to convert bytes to kilobytes. Round these up * to the next whole kilobyte. @@ -166,19 +161,6 @@ static ExplainWorkersState *ExplainCreateWorkersState(int num_workers); static void ExplainOpenWorker(int n, ExplainState *es); static void ExplainCloseWorker(int n, ExplainState *es); static void ExplainFlushWorkersState(ExplainState *es); -static void ExplainProperty(const char *qlabel, const char *unit, - const char *value, bool numeric, ExplainState *es); -static void ExplainOpenSetAsideGroup(const char *objtype, const char *labelname, - bool labeled, int depth, ExplainState *es); -static void ExplainSaveGroup(ExplainState *es, int depth, int *state_save); -static void ExplainRestoreGroup(ExplainState *es, int depth, int *state_save); -static void ExplainDummyGroup(const char *objtype, const char *labelname, - ExplainState *es); -static void ExplainXMLTag(const char *tagname, int flags, ExplainState *es); -static void ExplainIndentText(ExplainState *es); -static void ExplainJSONLineEnding(ExplainState *es); -static void ExplainYAMLLineStarting(ExplainState *es); -static void escape_yaml(StringInfo buf, const char *str); static SerializeMetrics GetSerializationMetrics(DestReceiver *dest); @@ -4950,690 +4932,6 @@ ExplainFlushWorkersState(ExplainState *es) pfree(wstate); } -/* - * Explain a property, such as sort keys or targets, that takes the form of - * a list of unlabeled items. "data" is a list of C strings. - */ -void -ExplainPropertyList(const char *qlabel, List *data, ExplainState *es) -{ - ListCell *lc; - bool first = true; - - switch (es->format) - { - case EXPLAIN_FORMAT_TEXT: - ExplainIndentText(es); - appendStringInfo(es->str, "%s: ", qlabel); - foreach(lc, data) - { - if (!first) - appendStringInfoString(es->str, ", "); - appendStringInfoString(es->str, (const char *) lfirst(lc)); - first = false; - } - appendStringInfoChar(es->str, '\n'); - break; - - case EXPLAIN_FORMAT_XML: - ExplainXMLTag(qlabel, X_OPENING, es); - foreach(lc, data) - { - char *str; - - appendStringInfoSpaces(es->str, es->indent * 2 + 2); - appendStringInfoString(es->str, "<Item>"); - str = escape_xml((const char *) lfirst(lc)); - appendStringInfoString(es->str, str); - pfree(str); - appendStringInfoString(es->str, "</Item>\n"); - } - ExplainXMLTag(qlabel, X_CLOSING, es); - break; - - case EXPLAIN_FORMAT_JSON: - ExplainJSONLineEnding(es); - appendStringInfoSpaces(es->str, es->indent * 2); - escape_json(es->str, qlabel); - appendStringInfoString(es->str, ": ["); - foreach(lc, data) - { - if (!first) - appendStringInfoString(es->str, ", "); - escape_json(es->str, (const char *) lfirst(lc)); - first = false; - } - appendStringInfoChar(es->str, ']'); - break; - - case EXPLAIN_FORMAT_YAML: - ExplainYAMLLineStarting(es); - appendStringInfo(es->str, "%s: ", qlabel); - foreach(lc, data) - { - appendStringInfoChar(es->str, '\n'); - appendStringInfoSpaces(es->str, es->indent * 2 + 2); - appendStringInfoString(es->str, "- "); - escape_yaml(es->str, (const char *) lfirst(lc)); - } - break; - } -} - -/* - * Explain a property that takes the form of a list of unlabeled items within - * another list. "data" is a list of C strings. - */ -void -ExplainPropertyListNested(const char *qlabel, List *data, ExplainState *es) -{ - ListCell *lc; - bool first = true; - - switch (es->format) - { - case EXPLAIN_FORMAT_TEXT: - case EXPLAIN_FORMAT_XML: - ExplainPropertyList(qlabel, data, es); - return; - - case EXPLAIN_FORMAT_JSON: - ExplainJSONLineEnding(es); - appendStringInfoSpaces(es->str, es->indent * 2); - appendStringInfoChar(es->str, '['); - foreach(lc, data) - { - if (!first) - appendStringInfoString(es->str, ", "); - escape_json(es->str, (const char *) lfirst(lc)); - first = false; - } - appendStringInfoChar(es->str, ']'); - break; - - case EXPLAIN_FORMAT_YAML: - ExplainYAMLLineStarting(es); - appendStringInfoString(es->str, "- ["); - foreach(lc, data) - { - if (!first) - appendStringInfoString(es->str, ", "); - escape_yaml(es->str, (const char *) lfirst(lc)); - first = false; - } - appendStringInfoChar(es->str, ']'); - break; - } -} - -/* - * Explain a simple property. - * - * If "numeric" is true, the value is a number (or other value that - * doesn't need quoting in JSON). - * - * If unit is non-NULL the text format will display it after the value. - * - * This usually should not be invoked directly, but via one of the datatype - * specific routines ExplainPropertyText, ExplainPropertyInteger, etc. - */ -static void -ExplainProperty(const char *qlabel, const char *unit, const char *value, - bool numeric, ExplainState *es) -{ - switch (es->format) - { - case EXPLAIN_FORMAT_TEXT: - ExplainIndentText(es); - if (unit) - appendStringInfo(es->str, "%s: %s %s\n", qlabel, value, unit); - else - appendStringInfo(es->str, "%s: %s\n", qlabel, value); - break; - - case EXPLAIN_FORMAT_XML: - { - char *str; - - appendStringInfoSpaces(es->str, es->indent * 2); - ExplainXMLTag(qlabel, X_OPENING | X_NOWHITESPACE, es); - str = escape_xml(value); - appendStringInfoString(es->str, str); - pfree(str); - ExplainXMLTag(qlabel, X_CLOSING | X_NOWHITESPACE, es); - appendStringInfoChar(es->str, '\n'); - } - break; - - case EXPLAIN_FORMAT_JSON: - ExplainJSONLineEnding(es); - appendStringInfoSpaces(es->str, es->indent * 2); - escape_json(es->str, qlabel); - appendStringInfoString(es->str, ": "); - if (numeric) - appendStringInfoString(es->str, value); - else - escape_json(es->str, value); - break; - - case EXPLAIN_FORMAT_YAML: - ExplainYAMLLineStarting(es); - appendStringInfo(es->str, "%s: ", qlabel); - if (numeric) - appendStringInfoString(es->str, value); - else - escape_yaml(es->str, value); - break; - } -} - -/* - * Explain a string-valued property. - */ -void -ExplainPropertyText(const char *qlabel, const char *value, ExplainState *es) -{ - ExplainProperty(qlabel, NULL, value, false, es); -} - -/* - * Explain an integer-valued property. - */ -void -ExplainPropertyInteger(const char *qlabel, const char *unit, int64 value, - ExplainState *es) -{ - char buf[32]; - - snprintf(buf, sizeof(buf), INT64_FORMAT, value); - ExplainProperty(qlabel, unit, buf, true, es); -} - -/* - * Explain an unsigned integer-valued property. - */ -void -ExplainPropertyUInteger(const char *qlabel, const char *unit, uint64 value, - ExplainState *es) -{ - char buf[32]; - - snprintf(buf, sizeof(buf), UINT64_FORMAT, value); - ExplainProperty(qlabel, unit, buf, true, es); -} - -/* - * Explain a float-valued property, using the specified number of - * fractional digits. - */ -void -ExplainPropertyFloat(const char *qlabel, const char *unit, double value, - int ndigits, ExplainState *es) -{ - char *buf; - - buf = psprintf("%.*f", ndigits, value); - ExplainProperty(qlabel, unit, buf, true, es); - pfree(buf); -} - -/* - * Explain a bool-valued property. - */ -void -ExplainPropertyBool(const char *qlabel, bool value, ExplainState *es) -{ - ExplainProperty(qlabel, NULL, value ? "true" : "false", true, es); -} - -/* - * Open a group of related objects. - * - * objtype is the type of the group object, labelname is its label within - * a containing object (if any). - * - * If labeled is true, the group members will be labeled properties, - * while if it's false, they'll be unlabeled objects. - */ -void -ExplainOpenGroup(const char *objtype, const char *labelname, - bool labeled, ExplainState *es) -{ - switch (es->format) - { - case EXPLAIN_FORMAT_TEXT: - /* nothing to do */ - break; - - case EXPLAIN_FORMAT_XML: - ExplainXMLTag(objtype, X_OPENING, es); - es->indent++; - break; - - case EXPLAIN_FORMAT_JSON: - ExplainJSONLineEnding(es); - appendStringInfoSpaces(es->str, 2 * es->indent); - if (labelname) - { - escape_json(es->str, labelname); - appendStringInfoString(es->str, ": "); - } - appendStringInfoChar(es->str, labeled ? '{' : '['); - - /* - * In JSON format, the grouping_stack is an integer list. 0 means - * we've emitted nothing at this grouping level, 1 means we've - * emitted something (and so the next item needs a comma). See - * ExplainJSONLineEnding(). - */ - es->grouping_stack = lcons_int(0, es->grouping_stack); - es->indent++; - break; - - case EXPLAIN_FORMAT_YAML: - - /* - * In YAML format, the grouping stack is an integer list. 0 means - * we've emitted nothing at this grouping level AND this grouping - * level is unlabeled and must be marked with "- ". See - * ExplainYAMLLineStarting(). - */ - ExplainYAMLLineStarting(es); - if (labelname) - { - appendStringInfo(es->str, "%s: ", labelname); - es->grouping_stack = lcons_int(1, es->grouping_stack); - } - else - { - appendStringInfoString(es->str, "- "); - es->grouping_stack = lcons_int(0, es->grouping_stack); - } - es->indent++; - break; - } -} - -/* - * Close a group of related objects. - * Parameters must match the corresponding ExplainOpenGroup call. - */ -void -ExplainCloseGroup(const char *objtype, const char *labelname, - bool labeled, ExplainState *es) -{ - switch (es->format) - { - case EXPLAIN_FORMAT_TEXT: - /* nothing to do */ - break; - - case EXPLAIN_FORMAT_XML: - es->indent--; - ExplainXMLTag(objtype, X_CLOSING, es); - break; - - case EXPLAIN_FORMAT_JSON: - es->indent--; - appendStringInfoChar(es->str, '\n'); - appendStringInfoSpaces(es->str, 2 * es->indent); - appendStringInfoChar(es->str, labeled ? '}' : ']'); - es->grouping_stack = list_delete_first(es->grouping_stack); - break; - - case EXPLAIN_FORMAT_YAML: - es->indent--; - es->grouping_stack = list_delete_first(es->grouping_stack); - break; - } -} - -/* - * Open a group of related objects, without emitting actual data. - * - * Prepare the formatting state as though we were beginning a group with - * the identified properties, but don't actually emit anything. Output - * subsequent to this call can be redirected into a separate output buffer, - * and then eventually appended to the main output buffer after doing a - * regular ExplainOpenGroup call (with the same parameters). - * - * The extra "depth" parameter is the new group's depth compared to current. - * It could be more than one, in case the eventual output will be enclosed - * in additional nesting group levels. We assume we don't need to track - * formatting state for those levels while preparing this group's output. - * - * There is no ExplainCloseSetAsideGroup --- in current usage, we always - * pop this state with ExplainSaveGroup. - */ -static void -ExplainOpenSetAsideGroup(const char *objtype, const char *labelname, - bool labeled, int depth, ExplainState *es) -{ - switch (es->format) - { - case EXPLAIN_FORMAT_TEXT: - /* nothing to do */ - break; - - case EXPLAIN_FORMAT_XML: - es->indent += depth; - break; - - case EXPLAIN_FORMAT_JSON: - es->grouping_stack = lcons_int(0, es->grouping_stack); - es->indent += depth; - break; - - case EXPLAIN_FORMAT_YAML: - if (labelname) - es->grouping_stack = lcons_int(1, es->grouping_stack); - else - es->grouping_stack = lcons_int(0, es->grouping_stack); - es->indent += depth; - break; - } -} - -/* - * Pop one level of grouping state, allowing for a re-push later. - * - * This is typically used after ExplainOpenSetAsideGroup; pass the - * same "depth" used for that. - * - * This should not emit any output. If state needs to be saved, - * save it at *state_save. Currently, an integer save area is sufficient - * for all formats, but we might need to revisit that someday. - */ -static void -ExplainSaveGroup(ExplainState *es, int depth, int *state_save) -{ - switch (es->format) - { - case EXPLAIN_FORMAT_TEXT: - /* nothing to do */ - break; - - case EXPLAIN_FORMAT_XML: - es->indent -= depth; - break; - - case EXPLAIN_FORMAT_JSON: - es->indent -= depth; - *state_save = linitial_int(es->grouping_stack); - es->grouping_stack = list_delete_first(es->grouping_stack); - break; - - case EXPLAIN_FORMAT_YAML: - es->indent -= depth; - *state_save = linitial_int(es->grouping_stack); - es->grouping_stack = list_delete_first(es->grouping_stack); - break; - } -} - -/* - * Re-push one level of grouping state, undoing the effects of ExplainSaveGroup. - */ -static void -ExplainRestoreGroup(ExplainState *es, int depth, int *state_save) -{ - switch (es->format) - { - case EXPLAIN_FORMAT_TEXT: - /* nothing to do */ - break; - - case EXPLAIN_FORMAT_XML: - es->indent += depth; - break; - - case EXPLAIN_FORMAT_JSON: - es->grouping_stack = lcons_int(*state_save, es->grouping_stack); - es->indent += depth; - break; - - case EXPLAIN_FORMAT_YAML: - es->grouping_stack = lcons_int(*state_save, es->grouping_stack); - es->indent += depth; - break; - } -} - -/* - * Emit a "dummy" group that never has any members. - * - * objtype is the type of the group object, labelname is its label within - * a containing object (if any). - */ -static void -ExplainDummyGroup(const char *objtype, const char *labelname, ExplainState *es) -{ - switch (es->format) - { - case EXPLAIN_FORMAT_TEXT: - /* nothing to do */ - break; - - case EXPLAIN_FORMAT_XML: - ExplainXMLTag(objtype, X_CLOSE_IMMEDIATE, es); - break; - - case EXPLAIN_FORMAT_JSON: - ExplainJSONLineEnding(es); - appendStringInfoSpaces(es->str, 2 * es->indent); - if (labelname) - { - escape_json(es->str, labelname); - appendStringInfoString(es->str, ": "); - } - escape_json(es->str, objtype); - break; - - case EXPLAIN_FORMAT_YAML: - ExplainYAMLLineStarting(es); - if (labelname) - { - escape_yaml(es->str, labelname); - appendStringInfoString(es->str, ": "); - } - else - { - appendStringInfoString(es->str, "- "); - } - escape_yaml(es->str, objtype); - break; - } -} - -/* - * Emit the start-of-output boilerplate. - * - * This is just enough different from processing a subgroup that we need - * a separate pair of subroutines. - */ -void -ExplainBeginOutput(ExplainState *es) -{ - switch (es->format) - { - case EXPLAIN_FORMAT_TEXT: - /* nothing to do */ - break; - - case EXPLAIN_FORMAT_XML: - appendStringInfoString(es->str, - "<explain xmlns=\"http://www.postgresql.org/2009/explain\">\n"); - es->indent++; - break; - - case EXPLAIN_FORMAT_JSON: - /* top-level structure is an array of plans */ - appendStringInfoChar(es->str, '['); - es->grouping_stack = lcons_int(0, es->grouping_stack); - es->indent++; - break; - - case EXPLAIN_FORMAT_YAML: - es->grouping_stack = lcons_int(0, es->grouping_stack); - break; - } -} - -/* - * Emit the end-of-output boilerplate. - */ -void -ExplainEndOutput(ExplainState *es) -{ - switch (es->format) - { - case EXPLAIN_FORMAT_TEXT: - /* nothing to do */ - break; - - case EXPLAIN_FORMAT_XML: - es->indent--; - appendStringInfoString(es->str, "</explain>"); - break; - - case EXPLAIN_FORMAT_JSON: - es->indent--; - appendStringInfoString(es->str, "\n]"); - es->grouping_stack = list_delete_first(es->grouping_stack); - break; - - case EXPLAIN_FORMAT_YAML: - es->grouping_stack = list_delete_first(es->grouping_stack); - break; - } -} - -/* - * Put an appropriate separator between multiple plans - */ -void -ExplainSeparatePlans(ExplainState *es) -{ - switch (es->format) - { - case EXPLAIN_FORMAT_TEXT: - /* add a blank line */ - appendStringInfoChar(es->str, '\n'); - break; - - case EXPLAIN_FORMAT_XML: - case EXPLAIN_FORMAT_JSON: - case EXPLAIN_FORMAT_YAML: - /* nothing to do */ - break; - } -} - -/* - * Emit opening or closing XML tag. - * - * "flags" must contain X_OPENING, X_CLOSING, or X_CLOSE_IMMEDIATE. - * Optionally, OR in X_NOWHITESPACE to suppress the whitespace we'd normally - * add. - * - * XML restricts tag names more than our other output formats, eg they can't - * contain white space or slashes. Replace invalid characters with dashes, - * so that for example "I/O Read Time" becomes "I-O-Read-Time". - */ -static void -ExplainXMLTag(const char *tagname, int flags, ExplainState *es) -{ - const char *s; - const char *valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_."; - - if ((flags & X_NOWHITESPACE) == 0) - appendStringInfoSpaces(es->str, 2 * es->indent); - appendStringInfoCharMacro(es->str, '<'); - if ((flags & X_CLOSING) != 0) - appendStringInfoCharMacro(es->str, '/'); - for (s = tagname; *s; s++) - appendStringInfoChar(es->str, strchr(valid, *s) ? *s : '-'); - if ((flags & X_CLOSE_IMMEDIATE) != 0) - appendStringInfoString(es->str, " /"); - appendStringInfoCharMacro(es->str, '>'); - if ((flags & X_NOWHITESPACE) == 0) - appendStringInfoCharMacro(es->str, '\n'); -} - -/* - * Indent a text-format line. - * - * We indent by two spaces per indentation level. However, when emitting - * data for a parallel worker there might already be data on the current line - * (cf. ExplainOpenWorker); in that case, don't indent any more. - */ -static void -ExplainIndentText(ExplainState *es) -{ - Assert(es->format == EXPLAIN_FORMAT_TEXT); - if (es->str->len == 0 || es->str->data[es->str->len - 1] == '\n') - appendStringInfoSpaces(es->str, es->indent * 2); -} - -/* - * Emit a JSON line ending. - * - * JSON requires a comma after each property but the last. To facilitate this, - * in JSON format, the text emitted for each property begins just prior to the - * preceding line-break (and comma, if applicable). - */ -static void -ExplainJSONLineEnding(ExplainState *es) -{ - Assert(es->format == EXPLAIN_FORMAT_JSON); - if (linitial_int(es->grouping_stack) != 0) - appendStringInfoChar(es->str, ','); - else - linitial_int(es->grouping_stack) = 1; - appendStringInfoChar(es->str, '\n'); -} - -/* - * Indent a YAML line. - * - * YAML lines are ordinarily indented by two spaces per indentation level. - * The text emitted for each property begins just prior to the preceding - * line-break, except for the first property in an unlabeled group, for which - * it begins immediately after the "- " that introduces the group. The first - * property of the group appears on the same line as the opening "- ". - */ -static void -ExplainYAMLLineStarting(ExplainState *es) -{ - Assert(es->format == EXPLAIN_FORMAT_YAML); - if (linitial_int(es->grouping_stack) == 0) - { - linitial_int(es->grouping_stack) = 1; - } - else - { - appendStringInfoChar(es->str, '\n'); - appendStringInfoSpaces(es->str, es->indent * 2); - } -} - -/* - * YAML is a superset of JSON; unfortunately, the YAML quoting rules are - * ridiculously complicated -- as documented in sections 5.3 and 7.3.3 of - * http://yaml.org/spec/1.2/spec.html -- so we chose to just quote everything. - * Empty strings, strings with leading or trailing whitespace, and strings - * containing a variety of special characters must certainly be quoted or the - * output is invalid; and other seemingly harmless strings like "0xa" or - * "true" must be quoted, lest they be interpreted as a hexadecimal or Boolean - * constant rather than a string. - */ -static void -escape_yaml(StringInfo buf, const char *str) -{ - escape_json(buf, str); -} - - /* * DestReceiver functions for SERIALIZE option * diff --git a/src/backend/commands/explain_format.c b/src/backend/commands/explain_format.c new file mode 100644 index 00000000000..bccdd76a874 --- /dev/null +++ b/src/backend/commands/explain_format.c @@ -0,0 +1,713 @@ +/*------------------------------------------------------------------------- + * + * explain_format.c + * Format routines for explaining query execution plans + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * IDENTIFICATION + * src/backend/commands/explain_format.c + * + *------------------------------------------------------------------------- + */ +#include "postgres.h" + +#include "commands/explain.h" +#include "commands/explain_format.h" +#include "utils/json.h" +#include "utils/xml.h" + +/* OR-able flags for ExplainXMLTag() */ +#define X_OPENING 0 +#define X_CLOSING 1 +#define X_CLOSE_IMMEDIATE 2 +#define X_NOWHITESPACE 4 + +static void ExplainJSONLineEnding(ExplainState *es); +static void ExplainXMLTag(const char *tagname, int flags, ExplainState *es); +static void ExplainYAMLLineStarting(ExplainState *es); +static void escape_yaml(StringInfo buf, const char *str); + +/* + * Explain a property, such as sort keys or targets, that takes the form of + * a list of unlabeled items. "data" is a list of C strings. + */ +void +ExplainPropertyList(const char *qlabel, List *data, ExplainState *es) +{ + ListCell *lc; + bool first = true; + + switch (es->format) + { + case EXPLAIN_FORMAT_TEXT: + ExplainIndentText(es); + appendStringInfo(es->str, "%s: ", qlabel); + foreach(lc, data) + { + if (!first) + appendStringInfoString(es->str, ", "); + appendStringInfoString(es->str, (const char *) lfirst(lc)); + first = false; + } + appendStringInfoChar(es->str, '\n'); + break; + + case EXPLAIN_FORMAT_XML: + ExplainXMLTag(qlabel, X_OPENING, es); + foreach(lc, data) + { + char *str; + + appendStringInfoSpaces(es->str, es->indent * 2 + 2); + appendStringInfoString(es->str, "<Item>"); + str = escape_xml((const char *) lfirst(lc)); + appendStringInfoString(es->str, str); + pfree(str); + appendStringInfoString(es->str, "</Item>\n"); + } + ExplainXMLTag(qlabel, X_CLOSING, es); + break; + + case EXPLAIN_FORMAT_JSON: + ExplainJSONLineEnding(es); + appendStringInfoSpaces(es->str, es->indent * 2); + escape_json(es->str, qlabel); + appendStringInfoString(es->str, ": ["); + foreach(lc, data) + { + if (!first) + appendStringInfoString(es->str, ", "); + escape_json(es->str, (const char *) lfirst(lc)); + first = false; + } + appendStringInfoChar(es->str, ']'); + break; + + case EXPLAIN_FORMAT_YAML: + ExplainYAMLLineStarting(es); + appendStringInfo(es->str, "%s: ", qlabel); + foreach(lc, data) + { + appendStringInfoChar(es->str, '\n'); + appendStringInfoSpaces(es->str, es->indent * 2 + 2); + appendStringInfoString(es->str, "- "); + escape_yaml(es->str, (const char *) lfirst(lc)); + } + break; + } +} + +/* + * Explain a property that takes the form of a list of unlabeled items within + * another list. "data" is a list of C strings. + */ +void +ExplainPropertyListNested(const char *qlabel, List *data, ExplainState *es) +{ + ListCell *lc; + bool first = true; + + switch (es->format) + { + case EXPLAIN_FORMAT_TEXT: + case EXPLAIN_FORMAT_XML: + ExplainPropertyList(qlabel, data, es); + return; + + case EXPLAIN_FORMAT_JSON: + ExplainJSONLineEnding(es); + appendStringInfoSpaces(es->str, es->indent * 2); + appendStringInfoChar(es->str, '['); + foreach(lc, data) + { + if (!first) + appendStringInfoString(es->str, ", "); + escape_json(es->str, (const char *) lfirst(lc)); + first = false; + } + appendStringInfoChar(es->str, ']'); + break; + + case EXPLAIN_FORMAT_YAML: + ExplainYAMLLineStarting(es); + appendStringInfoString(es->str, "- ["); + foreach(lc, data) + { + if (!first) + appendStringInfoString(es->str, ", "); + escape_yaml(es->str, (const char *) lfirst(lc)); + first = false; + } + appendStringInfoChar(es->str, ']'); + break; + } +} + +/* + * Explain a simple property. + * + * If "numeric" is true, the value is a number (or other value that + * doesn't need quoting in JSON). + * + * If unit is non-NULL the text format will display it after the value. + * + * This usually should not be invoked directly, but via one of the datatype + * specific routines ExplainPropertyText, ExplainPropertyInteger, etc. + */ +static void +ExplainProperty(const char *qlabel, const char *unit, const char *value, + bool numeric, ExplainState *es) +{ + switch (es->format) + { + case EXPLAIN_FORMAT_TEXT: + ExplainIndentText(es); + if (unit) + appendStringInfo(es->str, "%s: %s %s\n", qlabel, value, unit); + else + appendStringInfo(es->str, "%s: %s\n", qlabel, value); + break; + + case EXPLAIN_FORMAT_XML: + { + char *str; + + appendStringInfoSpaces(es->str, es->indent * 2); + ExplainXMLTag(qlabel, X_OPENING | X_NOWHITESPACE, es); + str = escape_xml(value); + appendStringInfoString(es->str, str); + pfree(str); + ExplainXMLTag(qlabel, X_CLOSING | X_NOWHITESPACE, es); + appendStringInfoChar(es->str, '\n'); + } + break; + + case EXPLAIN_FORMAT_JSON: + ExplainJSONLineEnding(es); + appendStringInfoSpaces(es->str, es->indent * 2); + escape_json(es->str, qlabel); + appendStringInfoString(es->str, ": "); + if (numeric) + appendStringInfoString(es->str, value); + else + escape_json(es->str, value); + break; + + case EXPLAIN_FORMAT_YAML: + ExplainYAMLLineStarting(es); + appendStringInfo(es->str, "%s: ", qlabel); + if (numeric) + appendStringInfoString(es->str, value); + else + escape_yaml(es->str, value); + break; + } +} + +/* + * Explain a string-valued property. + */ +void +ExplainPropertyText(const char *qlabel, const char *value, ExplainState *es) +{ + ExplainProperty(qlabel, NULL, value, false, es); +} + +/* + * Explain an integer-valued property. + */ +void +ExplainPropertyInteger(const char *qlabel, const char *unit, int64 value, + ExplainState *es) +{ + char buf[32]; + + snprintf(buf, sizeof(buf), INT64_FORMAT, value); + ExplainProperty(qlabel, unit, buf, true, es); +} + +/* + * Explain an unsigned integer-valued property. + */ +void +ExplainPropertyUInteger(const char *qlabel, const char *unit, uint64 value, + ExplainState *es) +{ + char buf[32]; + + snprintf(buf, sizeof(buf), UINT64_FORMAT, value); + ExplainProperty(qlabel, unit, buf, true, es); +} + +/* + * Explain a float-valued property, using the specified number of + * fractional digits. + */ +void +ExplainPropertyFloat(const char *qlabel, const char *unit, double value, + int ndigits, ExplainState *es) +{ + char *buf; + + buf = psprintf("%.*f", ndigits, value); + ExplainProperty(qlabel, unit, buf, true, es); + pfree(buf); +} + +/* + * Explain a bool-valued property. + */ +void +ExplainPropertyBool(const char *qlabel, bool value, ExplainState *es) +{ + ExplainProperty(qlabel, NULL, value ? "true" : "false", true, es); +} + +/* + * Open a group of related objects. + * + * objtype is the type of the group object, labelname is its label within + * a containing object (if any). + * + * If labeled is true, the group members will be labeled properties, + * while if it's false, they'll be unlabeled objects. + */ +void +ExplainOpenGroup(const char *objtype, const char *labelname, + bool labeled, ExplainState *es) +{ + switch (es->format) + { + case EXPLAIN_FORMAT_TEXT: + /* nothing to do */ + break; + + case EXPLAIN_FORMAT_XML: + ExplainXMLTag(objtype, X_OPENING, es); + es->indent++; + break; + + case EXPLAIN_FORMAT_JSON: + ExplainJSONLineEnding(es); + appendStringInfoSpaces(es->str, 2 * es->indent); + if (labelname) + { + escape_json(es->str, labelname); + appendStringInfoString(es->str, ": "); + } + appendStringInfoChar(es->str, labeled ? '{' : '['); + + /* + * In JSON format, the grouping_stack is an integer list. 0 means + * we've emitted nothing at this grouping level, 1 means we've + * emitted something (and so the next item needs a comma). See + * ExplainJSONLineEnding(). + */ + es->grouping_stack = lcons_int(0, es->grouping_stack); + es->indent++; + break; + + case EXPLAIN_FORMAT_YAML: + + /* + * In YAML format, the grouping stack is an integer list. 0 means + * we've emitted nothing at this grouping level AND this grouping + * level is unlabeled and must be marked with "- ". See + * ExplainYAMLLineStarting(). + */ + ExplainYAMLLineStarting(es); + if (labelname) + { + appendStringInfo(es->str, "%s: ", labelname); + es->grouping_stack = lcons_int(1, es->grouping_stack); + } + else + { + appendStringInfoString(es->str, "- "); + es->grouping_stack = lcons_int(0, es->grouping_stack); + } + es->indent++; + break; + } +} + +/* + * Close a group of related objects. + * Parameters must match the corresponding ExplainOpenGroup call. + */ +void +ExplainCloseGroup(const char *objtype, const char *labelname, + bool labeled, ExplainState *es) +{ + switch (es->format) + { + case EXPLAIN_FORMAT_TEXT: + /* nothing to do */ + break; + + case EXPLAIN_FORMAT_XML: + es->indent--; + ExplainXMLTag(objtype, X_CLOSING, es); + break; + + case EXPLAIN_FORMAT_JSON: + es->indent--; + appendStringInfoChar(es->str, '\n'); + appendStringInfoSpaces(es->str, 2 * es->indent); + appendStringInfoChar(es->str, labeled ? '}' : ']'); + es->grouping_stack = list_delete_first(es->grouping_stack); + break; + + case EXPLAIN_FORMAT_YAML: + es->indent--; + es->grouping_stack = list_delete_first(es->grouping_stack); + break; + } +} + +/* + * Open a group of related objects, without emitting actual data. + * + * Prepare the formatting state as though we were beginning a group with + * the identified properties, but don't actually emit anything. Output + * subsequent to this call can be redirected into a separate output buffer, + * and then eventually appended to the main output buffer after doing a + * regular ExplainOpenGroup call (with the same parameters). + * + * The extra "depth" parameter is the new group's depth compared to current. + * It could be more than one, in case the eventual output will be enclosed + * in additional nesting group levels. We assume we don't need to track + * formatting state for those levels while preparing this group's output. + * + * There is no ExplainCloseSetAsideGroup --- in current usage, we always + * pop this state with ExplainSaveGroup. + */ +void +ExplainOpenSetAsideGroup(const char *objtype, const char *labelname, + bool labeled, int depth, ExplainState *es) +{ + switch (es->format) + { + case EXPLAIN_FORMAT_TEXT: + /* nothing to do */ + break; + + case EXPLAIN_FORMAT_XML: + es->indent += depth; + break; + + case EXPLAIN_FORMAT_JSON: + es->grouping_stack = lcons_int(0, es->grouping_stack); + es->indent += depth; + break; + + case EXPLAIN_FORMAT_YAML: + if (labelname) + es->grouping_stack = lcons_int(1, es->grouping_stack); + else + es->grouping_stack = lcons_int(0, es->grouping_stack); + es->indent += depth; + break; + } +} + +/* + * Pop one level of grouping state, allowing for a re-push later. + * + * This is typically used after ExplainOpenSetAsideGroup; pass the + * same "depth" used for that. + * + * This should not emit any output. If state needs to be saved, + * save it at *state_save. Currently, an integer save area is sufficient + * for all formats, but we might need to revisit that someday. + */ +void +ExplainSaveGroup(ExplainState *es, int depth, int *state_save) +{ + switch (es->format) + { + case EXPLAIN_FORMAT_TEXT: + /* nothing to do */ + break; + + case EXPLAIN_FORMAT_XML: + es->indent -= depth; + break; + + case EXPLAIN_FORMAT_JSON: + es->indent -= depth; + *state_save = linitial_int(es->grouping_stack); + es->grouping_stack = list_delete_first(es->grouping_stack); + break; + + case EXPLAIN_FORMAT_YAML: + es->indent -= depth; + *state_save = linitial_int(es->grouping_stack); + es->grouping_stack = list_delete_first(es->grouping_stack); + break; + } +} + +/* + * Re-push one level of grouping state, undoing the effects of ExplainSaveGroup. + */ +void +ExplainRestoreGroup(ExplainState *es, int depth, int *state_save) +{ + switch (es->format) + { + case EXPLAIN_FORMAT_TEXT: + /* nothing to do */ + break; + + case EXPLAIN_FORMAT_XML: + es->indent += depth; + break; + + case EXPLAIN_FORMAT_JSON: + es->grouping_stack = lcons_int(*state_save, es->grouping_stack); + es->indent += depth; + break; + + case EXPLAIN_FORMAT_YAML: + es->grouping_stack = lcons_int(*state_save, es->grouping_stack); + es->indent += depth; + break; + } +} + +/* + * Emit a "dummy" group that never has any members. + * + * objtype is the type of the group object, labelname is its label within + * a containing object (if any). + */ +void +ExplainDummyGroup(const char *objtype, const char *labelname, ExplainState *es) +{ + switch (es->format) + { + case EXPLAIN_FORMAT_TEXT: + /* nothing to do */ + break; + + case EXPLAIN_FORMAT_XML: + ExplainXMLTag(objtype, X_CLOSE_IMMEDIATE, es); + break; + + case EXPLAIN_FORMAT_JSON: + ExplainJSONLineEnding(es); + appendStringInfoSpaces(es->str, 2 * es->indent); + if (labelname) + { + escape_json(es->str, labelname); + appendStringInfoString(es->str, ": "); + } + escape_json(es->str, objtype); + break; + + case EXPLAIN_FORMAT_YAML: + ExplainYAMLLineStarting(es); + if (labelname) + { + escape_yaml(es->str, labelname); + appendStringInfoString(es->str, ": "); + } + else + { + appendStringInfoString(es->str, "- "); + } + escape_yaml(es->str, objtype); + break; + } +} + +/* + * Emit the start-of-output boilerplate. + * + * This is just enough different from processing a subgroup that we need + * a separate pair of subroutines. + */ +void +ExplainBeginOutput(ExplainState *es) +{ + switch (es->format) + { + case EXPLAIN_FORMAT_TEXT: + /* nothing to do */ + break; + + case EXPLAIN_FORMAT_XML: + appendStringInfoString(es->str, + "<explain xmlns=\"http://www.postgresql.org/2009/explain\">\n"); + es->indent++; + break; + + case EXPLAIN_FORMAT_JSON: + /* top-level structure is an array of plans */ + appendStringInfoChar(es->str, '['); + es->grouping_stack = lcons_int(0, es->grouping_stack); + es->indent++; + break; + + case EXPLAIN_FORMAT_YAML: + es->grouping_stack = lcons_int(0, es->grouping_stack); + break; + } +} + +/* + * Emit the end-of-output boilerplate. + */ +void +ExplainEndOutput(ExplainState *es) +{ + switch (es->format) + { + case EXPLAIN_FORMAT_TEXT: + /* nothing to do */ + break; + + case EXPLAIN_FORMAT_XML: + es->indent--; + appendStringInfoString(es->str, "</explain>"); + break; + + case EXPLAIN_FORMAT_JSON: + es->indent--; + appendStringInfoString(es->str, "\n]"); + es->grouping_stack = list_delete_first(es->grouping_stack); + break; + + case EXPLAIN_FORMAT_YAML: + es->grouping_stack = list_delete_first(es->grouping_stack); + break; + } +} + +/* + * Put an appropriate separator between multiple plans + */ +void +ExplainSeparatePlans(ExplainState *es) +{ + switch (es->format) + { + case EXPLAIN_FORMAT_TEXT: + /* add a blank line */ + appendStringInfoChar(es->str, '\n'); + break; + + case EXPLAIN_FORMAT_XML: + case EXPLAIN_FORMAT_JSON: + case EXPLAIN_FORMAT_YAML: + /* nothing to do */ + break; + } +} + +/* + * Emit opening or closing XML tag. + * + * "flags" must contain X_OPENING, X_CLOSING, or X_CLOSE_IMMEDIATE. + * Optionally, OR in X_NOWHITESPACE to suppress the whitespace we'd normally + * add. + * + * XML restricts tag names more than our other output formats, eg they can't + * contain white space or slashes. Replace invalid characters with dashes, + * so that for example "I/O Read Time" becomes "I-O-Read-Time". + */ +static void +ExplainXMLTag(const char *tagname, int flags, ExplainState *es) +{ + const char *s; + const char *valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_."; + + if ((flags & X_NOWHITESPACE) == 0) + appendStringInfoSpaces(es->str, 2 * es->indent); + appendStringInfoCharMacro(es->str, '<'); + if ((flags & X_CLOSING) != 0) + appendStringInfoCharMacro(es->str, '/'); + for (s = tagname; *s; s++) + appendStringInfoChar(es->str, strchr(valid, *s) ? *s : '-'); + if ((flags & X_CLOSE_IMMEDIATE) != 0) + appendStringInfoString(es->str, " /"); + appendStringInfoCharMacro(es->str, '>'); + if ((flags & X_NOWHITESPACE) == 0) + appendStringInfoCharMacro(es->str, '\n'); +} + +/* + * Indent a text-format line. + * + * We indent by two spaces per indentation level. However, when emitting + * data for a parallel worker there might already be data on the current line + * (cf. ExplainOpenWorker); in that case, don't indent any more. + */ +void +ExplainIndentText(ExplainState *es) +{ + Assert(es->format == EXPLAIN_FORMAT_TEXT); + if (es->str->len == 0 || es->str->data[es->str->len - 1] == '\n') + appendStringInfoSpaces(es->str, es->indent * 2); +} + +/* + * Emit a JSON line ending. + * + * JSON requires a comma after each property but the last. To facilitate this, + * in JSON format, the text emitted for each property begins just prior to the + * preceding line-break (and comma, if applicable). + */ +static void +ExplainJSONLineEnding(ExplainState *es) +{ + Assert(es->format == EXPLAIN_FORMAT_JSON); + if (linitial_int(es->grouping_stack) != 0) + appendStringInfoChar(es->str, ','); + else + linitial_int(es->grouping_stack) = 1; + appendStringInfoChar(es->str, '\n'); +} + +/* + * Indent a YAML line. + * + * YAML lines are ordinarily indented by two spaces per indentation level. + * The text emitted for each property begins just prior to the preceding + * line-break, except for the first property in an unlabeled group, for which + * it begins immediately after the "- " that introduces the group. The first + * property of the group appears on the same line as the opening "- ". + */ +static void +ExplainYAMLLineStarting(ExplainState *es) +{ + Assert(es->format == EXPLAIN_FORMAT_YAML); + if (linitial_int(es->grouping_stack) == 0) + { + linitial_int(es->grouping_stack) = 1; + } + else + { + appendStringInfoChar(es->str, '\n'); + appendStringInfoSpaces(es->str, es->indent * 2); + } +} + +/* + * YAML is a superset of JSON; unfortunately, the YAML quoting rules are + * ridiculously complicated -- as documented in sections 5.3 and 7.3.3 of + * http://yaml.org/spec/1.2/spec.html -- so we chose to just quote everything. + * Empty strings, strings with leading or trailing whitespace, and strings + * containing a variety of special characters must certainly be quoted or the + * output is invalid; and other seemingly harmless strings like "0xa" or + * "true" must be quoted, lest they be interpreted as a hexadecimal or Boolean + * constant rather than a string. + */ +static void +escape_yaml(StringInfo buf, const char *str) +{ + escape_json(buf, str); +} diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build index ef0d407a383..0d0106ec096 100644 --- a/src/backend/commands/meson.build +++ b/src/backend/commands/meson.build @@ -22,6 +22,7 @@ backend_sources += files( 'dropcmds.c', 'event_trigger.c', 'explain.c', + 'explain_format.c', 'extension.c', 'foreigncmds.c', 'functioncmds.c', diff --git a/src/backend/commands/prepare.c b/src/backend/commands/prepare.c index 8989c0c882d..149bc84187b 100644 --- a/src/backend/commands/prepare.c +++ b/src/backend/commands/prepare.c @@ -21,6 +21,7 @@ #include "access/xact.h" #include "catalog/pg_type.h" #include "commands/createas.h" +#include "commands/explain_format.h" #include "commands/prepare.h" #include "funcapi.h" #include "nodes/nodeFuncs.h" diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h index ea7419951f4..4aee075335d 100644 --- a/src/include/commands/explain.h +++ b/src/include/commands/explain.h @@ -118,30 +118,6 @@ extern void ExplainPrintJITSummary(ExplainState *es, QueryDesc *queryDesc); extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc); extern void ExplainQueryParameters(ExplainState *es, ParamListInfo params, int maxlen); -extern void ExplainBeginOutput(ExplainState *es); -extern void ExplainEndOutput(ExplainState *es); -extern void ExplainSeparatePlans(ExplainState *es); - -extern void ExplainPropertyList(const char *qlabel, List *data, - ExplainState *es); -extern void ExplainPropertyListNested(const char *qlabel, List *data, - ExplainState *es); -extern void ExplainPropertyText(const char *qlabel, const char *value, - ExplainState *es); -extern void ExplainPropertyInteger(const char *qlabel, const char *unit, - int64 value, ExplainState *es); -extern void ExplainPropertyUInteger(const char *qlabel, const char *unit, - uint64 value, ExplainState *es); -extern void ExplainPropertyFloat(const char *qlabel, const char *unit, - double value, int ndigits, ExplainState *es); -extern void ExplainPropertyBool(const char *qlabel, bool value, - ExplainState *es); - -extern void ExplainOpenGroup(const char *objtype, const char *labelname, - bool labeled, ExplainState *es); -extern void ExplainCloseGroup(const char *objtype, const char *labelname, - bool labeled, ExplainState *es); - extern DestReceiver *CreateExplainSerializeDestReceiver(ExplainState *es); #endif /* EXPLAIN_H */ diff --git a/src/include/commands/explain_format.h b/src/include/commands/explain_format.h new file mode 100644 index 00000000000..0460f0fd2af --- /dev/null +++ b/src/include/commands/explain_format.h @@ -0,0 +1,52 @@ +/*------------------------------------------------------------------------- + * + * explain_format.h + * prototypes for explain_format.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * src/include/commands/explain_format.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXPLAIN_FORMAT_H +#define EXPLAIN_FORMAT_H + +#include "commands/explain.h" + +extern void ExplainPropertyList(const char *qlabel, List *data, + ExplainState *es); +extern void ExplainPropertyListNested(const char *qlabel, List *data, + ExplainState *es); +extern void ExplainPropertyText(const char *qlabel, const char *value, + ExplainState *es); +extern void ExplainPropertyInteger(const char *qlabel, const char *unit, + int64 value, ExplainState *es); +extern void ExplainPropertyUInteger(const char *qlabel, const char *unit, + uint64 value, ExplainState *es); +extern void ExplainPropertyFloat(const char *qlabel, const char *unit, + double value, int ndigits, ExplainState *es); +extern void ExplainPropertyBool(const char *qlabel, bool value, + ExplainState *es); + +extern void ExplainOpenGroup(const char *objtype, const char *labelname, + bool labeled, ExplainState *es); +extern void ExplainCloseGroup(const char *objtype, const char *labelname, + bool labeled, ExplainState *es); + +extern void ExplainOpenSetAsideGroup(const char *objtype, const char *labelname, + bool labeled, int depth, ExplainState *es); +extern void ExplainSaveGroup(ExplainState *es, int depth, int *state_save); +extern void ExplainRestoreGroup(ExplainState *es, int depth, int *state_save); + +extern void ExplainDummyGroup(const char *objtype, const char *labelname, + ExplainState *es); + +extern void ExplainBeginOutput(ExplainState *es); +extern void ExplainEndOutput(ExplainState *es); +extern void ExplainSeparatePlans(ExplainState *es); + +extern void ExplainIndentText(ExplainState *es); + +#endif -- 2.39.3 (Apple Git-145) [application/octet-stream] v1-0002-Create-explain_dr.c-and-move-DestReceiver-related.patch (20.8K, ../../CA+TgmoYutMw1Jgo8BWUmB3TqnOhsEAJiYO=rOQufF4gPLWmkLQ@mail.gmail.com/3-v1-0002-Create-explain_dr.c-and-move-DestReceiver-related.patch) download | inline diff: From 945a525f746a95421381d4913071a3d323e7d799 Mon Sep 17 00:00:00 2001 From: Robert Haas <[email protected]> Date: Mon, 17 Feb 2025 12:53:34 -0500 Subject: [PATCH v1 2/2] Create explain_dr.c and move DestReceiver-related code there. explain.c has grown rather large, and the code that deals with the DestReceiver that supports the SERIALIZE option is pretty easily severable from the rest of explain.c; hence, move it to a separate file. --- src/backend/commands/Makefile | 1 + src/backend/commands/explain.c | 299 +---------------------------- src/backend/commands/explain_dr.c | 308 ++++++++++++++++++++++++++++++ src/backend/commands/meson.build | 1 + src/include/commands/explain_dr.h | 30 +++ 5 files changed, 341 insertions(+), 298 deletions(-) create mode 100644 src/backend/commands/explain_dr.c create mode 100644 src/include/commands/explain_dr.h diff --git a/src/backend/commands/Makefile b/src/backend/commands/Makefile index 04e406fb7cf..85cfea6fd71 100644 --- a/src/backend/commands/Makefile +++ b/src/backend/commands/Makefile @@ -34,6 +34,7 @@ OBJS = \ dropcmds.o \ event_trigger.o \ explain.o \ + explain_dr.o \ explain_format.o \ extension.o \ foreigncmds.o \ diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index a6c214b6a51..9cc546d3ab2 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -17,6 +17,7 @@ #include "catalog/pg_type.h" #include "commands/createas.h" #include "commands/defrem.h" +#include "commands/explain_dr.h" #include "commands/explain_format.h" #include "commands/prepare.h" #include "foreign/fdwapi.h" @@ -50,14 +51,6 @@ ExplainOneQuery_hook_type ExplainOneQuery_hook = NULL; explain_get_index_name_hook_type explain_get_index_name_hook = NULL; -/* Instrumentation data for SERIALIZE option */ -typedef struct SerializeMetrics -{ - uint64 bytesSent; /* # of bytes serialized */ - instr_time timeSpent; /* time spent serializing */ - BufferUsage bufferUsage; /* buffers accessed during serialization */ -} SerializeMetrics; - /* * Various places within need to convert bytes to kilobytes. Round these up * to the next whole kilobyte. @@ -161,7 +154,6 @@ static ExplainWorkersState *ExplainCreateWorkersState(int num_workers); static void ExplainOpenWorker(int n, ExplainState *es); static void ExplainCloseWorker(int n, ExplainState *es); static void ExplainFlushWorkersState(ExplainState *es); -static SerializeMetrics GetSerializationMetrics(DestReceiver *dest); @@ -4931,292 +4923,3 @@ ExplainFlushWorkersState(ExplainState *es) pfree(wstate->worker_state_save); pfree(wstate); } - -/* - * DestReceiver functions for SERIALIZE option - * - * A DestReceiver for query tuples, that serializes passed rows into RowData - * messages while measuring the resources expended and total serialized size, - * while never sending the data to the client. This allows measuring the - * overhead of deTOASTing and datatype out/sendfuncs, which are not otherwise - * exercisable without actually hitting the network. - */ -typedef struct SerializeDestReceiver -{ - DestReceiver pub; - ExplainState *es; /* this EXPLAIN statement's ExplainState */ - int8 format; /* text or binary, like pq wire protocol */ - TupleDesc attrinfo; /* the output tuple desc */ - int nattrs; /* current number of columns */ - FmgrInfo *finfos; /* precomputed call info for output fns */ - MemoryContext tmpcontext; /* per-row temporary memory context */ - StringInfoData buf; /* buffer to hold the constructed message */ - SerializeMetrics metrics; /* collected metrics */ -} SerializeDestReceiver; - -/* - * Get the function lookup info that we'll need for output. - * - * This is a subset of what printtup_prepare_info() does. We don't need to - * cope with format choices varying across columns, so it's slightly simpler. - */ -static void -serialize_prepare_info(SerializeDestReceiver *receiver, - TupleDesc typeinfo, int nattrs) -{ - /* get rid of any old data */ - if (receiver->finfos) - pfree(receiver->finfos); - receiver->finfos = NULL; - - receiver->attrinfo = typeinfo; - receiver->nattrs = nattrs; - if (nattrs <= 0) - return; - - receiver->finfos = (FmgrInfo *) palloc0(nattrs * sizeof(FmgrInfo)); - - for (int i = 0; i < nattrs; i++) - { - FmgrInfo *finfo = receiver->finfos + i; - Form_pg_attribute attr = TupleDescAttr(typeinfo, i); - Oid typoutput; - Oid typsend; - bool typisvarlena; - - if (receiver->format == 0) - { - /* wire protocol format text */ - getTypeOutputInfo(attr->atttypid, - &typoutput, - &typisvarlena); - fmgr_info(typoutput, finfo); - } - else if (receiver->format == 1) - { - /* wire protocol format binary */ - getTypeBinaryOutputInfo(attr->atttypid, - &typsend, - &typisvarlena); - fmgr_info(typsend, finfo); - } - else - ereport(ERROR, - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("unsupported format code: %d", receiver->format))); - } -} - -/* - * serializeAnalyzeReceive - collect tuples for EXPLAIN (SERIALIZE) - * - * This should match printtup() in printtup.c as closely as possible, - * except for the addition of measurement code. - */ -static bool -serializeAnalyzeReceive(TupleTableSlot *slot, DestReceiver *self) -{ - TupleDesc typeinfo = slot->tts_tupleDescriptor; - SerializeDestReceiver *myState = (SerializeDestReceiver *) self; - MemoryContext oldcontext; - StringInfo buf = &myState->buf; - int natts = typeinfo->natts; - instr_time start, - end; - BufferUsage instr_start; - - /* only measure time, buffers if requested */ - if (myState->es->timing) - INSTR_TIME_SET_CURRENT(start); - if (myState->es->buffers) - instr_start = pgBufferUsage; - - /* Set or update my derived attribute info, if needed */ - if (myState->attrinfo != typeinfo || myState->nattrs != natts) - serialize_prepare_info(myState, typeinfo, natts); - - /* Make sure the tuple is fully deconstructed */ - slot_getallattrs(slot); - - /* Switch into per-row context so we can recover memory below */ - oldcontext = MemoryContextSwitchTo(myState->tmpcontext); - - /* - * Prepare a DataRow message (note buffer is in per-query context) - * - * Note that we fill a StringInfo buffer the same as printtup() does, so - * as to capture the costs of manipulating the strings accurately. - */ - pq_beginmessage_reuse(buf, PqMsg_DataRow); - - pq_sendint16(buf, natts); - - /* - * send the attributes of this tuple - */ - for (int i = 0; i < natts; i++) - { - FmgrInfo *finfo = myState->finfos + i; - Datum attr = slot->tts_values[i]; - - if (slot->tts_isnull[i]) - { - pq_sendint32(buf, -1); - continue; - } - - if (myState->format == 0) - { - /* Text output */ - char *outputstr; - - outputstr = OutputFunctionCall(finfo, attr); - pq_sendcountedtext(buf, outputstr, strlen(outputstr)); - } - else - { - /* Binary output */ - bytea *outputbytes; - - outputbytes = SendFunctionCall(finfo, attr); - pq_sendint32(buf, VARSIZE(outputbytes) - VARHDRSZ); - pq_sendbytes(buf, VARDATA(outputbytes), - VARSIZE(outputbytes) - VARHDRSZ); - } - } - - /* - * We mustn't call pq_endmessage_reuse(), since that would actually send - * the data to the client. Just count the data, instead. We can leave - * the buffer alone; it'll be reset on the next iteration (as would also - * happen in printtup()). - */ - myState->metrics.bytesSent += buf->len; - - /* Return to caller's context, and flush row's temporary memory */ - MemoryContextSwitchTo(oldcontext); - MemoryContextReset(myState->tmpcontext); - - /* Update timing data */ - if (myState->es->timing) - { - INSTR_TIME_SET_CURRENT(end); - INSTR_TIME_ACCUM_DIFF(myState->metrics.timeSpent, end, start); - } - - /* Update buffer metrics */ - if (myState->es->buffers) - BufferUsageAccumDiff(&myState->metrics.bufferUsage, - &pgBufferUsage, - &instr_start); - - return true; -} - -/* - * serializeAnalyzeStartup - start up the serializeAnalyze receiver - */ -static void -serializeAnalyzeStartup(DestReceiver *self, int operation, TupleDesc typeinfo) -{ - SerializeDestReceiver *receiver = (SerializeDestReceiver *) self; - - Assert(receiver->es != NULL); - - switch (receiver->es->serialize) - { - case EXPLAIN_SERIALIZE_NONE: - Assert(false); - break; - case EXPLAIN_SERIALIZE_TEXT: - receiver->format = 0; /* wire protocol format text */ - break; - case EXPLAIN_SERIALIZE_BINARY: - receiver->format = 1; /* wire protocol format binary */ - break; - } - - /* Create per-row temporary memory context */ - receiver->tmpcontext = AllocSetContextCreate(CurrentMemoryContext, - "SerializeTupleReceive", - ALLOCSET_DEFAULT_SIZES); - - /* The output buffer is re-used across rows, as in printtup.c */ - initStringInfo(&receiver->buf); - - /* Initialize results counters */ - memset(&receiver->metrics, 0, sizeof(SerializeMetrics)); - INSTR_TIME_SET_ZERO(receiver->metrics.timeSpent); -} - -/* - * serializeAnalyzeShutdown - shut down the serializeAnalyze receiver - */ -static void -serializeAnalyzeShutdown(DestReceiver *self) -{ - SerializeDestReceiver *receiver = (SerializeDestReceiver *) self; - - if (receiver->finfos) - pfree(receiver->finfos); - receiver->finfos = NULL; - - if (receiver->buf.data) - pfree(receiver->buf.data); - receiver->buf.data = NULL; - - if (receiver->tmpcontext) - MemoryContextDelete(receiver->tmpcontext); - receiver->tmpcontext = NULL; -} - -/* - * serializeAnalyzeDestroy - destroy the serializeAnalyze receiver - */ -static void -serializeAnalyzeDestroy(DestReceiver *self) -{ - pfree(self); -} - -/* - * Build a DestReceiver for EXPLAIN (SERIALIZE) instrumentation. - */ -DestReceiver * -CreateExplainSerializeDestReceiver(ExplainState *es) -{ - SerializeDestReceiver *self; - - self = (SerializeDestReceiver *) palloc0(sizeof(SerializeDestReceiver)); - - self->pub.receiveSlot = serializeAnalyzeReceive; - self->pub.rStartup = serializeAnalyzeStartup; - self->pub.rShutdown = serializeAnalyzeShutdown; - self->pub.rDestroy = serializeAnalyzeDestroy; - self->pub.mydest = DestExplainSerialize; - - self->es = es; - - return (DestReceiver *) self; -} - -/* - * GetSerializationMetrics - collect metrics - * - * We have to be careful here since the receiver could be an IntoRel - * receiver if the subject statement is CREATE TABLE AS. In that - * case, return all-zeroes stats. - */ -static SerializeMetrics -GetSerializationMetrics(DestReceiver *dest) -{ - SerializeMetrics empty; - - if (dest->mydest == DestExplainSerialize) - return ((SerializeDestReceiver *) dest)->metrics; - - memset(&empty, 0, sizeof(SerializeMetrics)); - INSTR_TIME_SET_ZERO(empty.timeSpent); - - return empty; -} diff --git a/src/backend/commands/explain_dr.c b/src/backend/commands/explain_dr.c new file mode 100644 index 00000000000..a0a37ea70f4 --- /dev/null +++ b/src/backend/commands/explain_dr.c @@ -0,0 +1,308 @@ +/*------------------------------------------------------------------------- + * + * explain_dr.c + * Explain DestReceiver to measure serialization overhead + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * IDENTIFICATION + * src/backend/commands/explain.c + * + *------------------------------------------------------------------------- + */ +#include "postgres.h" + +#include "commands/explain_dr.h" +#include "libpq/pqformat.h" +#include "libpq/protocol.h" +#include "utils/lsyscache.h" + +/* + * DestReceiver functions for SERIALIZE option + * + * A DestReceiver for query tuples, that serializes passed rows into RowData + * messages while measuring the resources expended and total serialized size, + * while never sending the data to the client. This allows measuring the + * overhead of deTOASTing and datatype out/sendfuncs, which are not otherwise + * exercisable without actually hitting the network. + */ +typedef struct SerializeDestReceiver +{ + DestReceiver pub; + ExplainState *es; /* this EXPLAIN statement's ExplainState */ + int8 format; /* text or binary, like pq wire protocol */ + TupleDesc attrinfo; /* the output tuple desc */ + int nattrs; /* current number of columns */ + FmgrInfo *finfos; /* precomputed call info for output fns */ + MemoryContext tmpcontext; /* per-row temporary memory context */ + StringInfoData buf; /* buffer to hold the constructed message */ + SerializeMetrics metrics; /* collected metrics */ +} SerializeDestReceiver; + +/* + * Get the function lookup info that we'll need for output. + * + * This is a subset of what printtup_prepare_info() does. We don't need to + * cope with format choices varying across columns, so it's slightly simpler. + */ +static void +serialize_prepare_info(SerializeDestReceiver *receiver, + TupleDesc typeinfo, int nattrs) +{ + /* get rid of any old data */ + if (receiver->finfos) + pfree(receiver->finfos); + receiver->finfos = NULL; + + receiver->attrinfo = typeinfo; + receiver->nattrs = nattrs; + if (nattrs <= 0) + return; + + receiver->finfos = (FmgrInfo *) palloc0(nattrs * sizeof(FmgrInfo)); + + for (int i = 0; i < nattrs; i++) + { + FmgrInfo *finfo = receiver->finfos + i; + Form_pg_attribute attr = TupleDescAttr(typeinfo, i); + Oid typoutput; + Oid typsend; + bool typisvarlena; + + if (receiver->format == 0) + { + /* wire protocol format text */ + getTypeOutputInfo(attr->atttypid, + &typoutput, + &typisvarlena); + fmgr_info(typoutput, finfo); + } + else if (receiver->format == 1) + { + /* wire protocol format binary */ + getTypeBinaryOutputInfo(attr->atttypid, + &typsend, + &typisvarlena); + fmgr_info(typsend, finfo); + } + else + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("unsupported format code: %d", receiver->format))); + } +} + +/* + * serializeAnalyzeReceive - collect tuples for EXPLAIN (SERIALIZE) + * + * This should match printtup() in printtup.c as closely as possible, + * except for the addition of measurement code. + */ +static bool +serializeAnalyzeReceive(TupleTableSlot *slot, DestReceiver *self) +{ + TupleDesc typeinfo = slot->tts_tupleDescriptor; + SerializeDestReceiver *myState = (SerializeDestReceiver *) self; + MemoryContext oldcontext; + StringInfo buf = &myState->buf; + int natts = typeinfo->natts; + instr_time start, + end; + BufferUsage instr_start; + + /* only measure time, buffers if requested */ + if (myState->es->timing) + INSTR_TIME_SET_CURRENT(start); + if (myState->es->buffers) + instr_start = pgBufferUsage; + + /* Set or update my derived attribute info, if needed */ + if (myState->attrinfo != typeinfo || myState->nattrs != natts) + serialize_prepare_info(myState, typeinfo, natts); + + /* Make sure the tuple is fully deconstructed */ + slot_getallattrs(slot); + + /* Switch into per-row context so we can recover memory below */ + oldcontext = MemoryContextSwitchTo(myState->tmpcontext); + + /* + * Prepare a DataRow message (note buffer is in per-query context) + * + * Note that we fill a StringInfo buffer the same as printtup() does, so + * as to capture the costs of manipulating the strings accurately. + */ + pq_beginmessage_reuse(buf, PqMsg_DataRow); + + pq_sendint16(buf, natts); + + /* + * send the attributes of this tuple + */ + for (int i = 0; i < natts; i++) + { + FmgrInfo *finfo = myState->finfos + i; + Datum attr = slot->tts_values[i]; + + if (slot->tts_isnull[i]) + { + pq_sendint32(buf, -1); + continue; + } + + if (myState->format == 0) + { + /* Text output */ + char *outputstr; + + outputstr = OutputFunctionCall(finfo, attr); + pq_sendcountedtext(buf, outputstr, strlen(outputstr)); + } + else + { + /* Binary output */ + bytea *outputbytes; + + outputbytes = SendFunctionCall(finfo, attr); + pq_sendint32(buf, VARSIZE(outputbytes) - VARHDRSZ); + pq_sendbytes(buf, VARDATA(outputbytes), + VARSIZE(outputbytes) - VARHDRSZ); + } + } + + /* + * We mustn't call pq_endmessage_reuse(), since that would actually send + * the data to the client. Just count the data, instead. We can leave + * the buffer alone; it'll be reset on the next iteration (as would also + * happen in printtup()). + */ + myState->metrics.bytesSent += buf->len; + + /* Return to caller's context, and flush row's temporary memory */ + MemoryContextSwitchTo(oldcontext); + MemoryContextReset(myState->tmpcontext); + + /* Update timing data */ + if (myState->es->timing) + { + INSTR_TIME_SET_CURRENT(end); + INSTR_TIME_ACCUM_DIFF(myState->metrics.timeSpent, end, start); + } + + /* Update buffer metrics */ + if (myState->es->buffers) + BufferUsageAccumDiff(&myState->metrics.bufferUsage, + &pgBufferUsage, + &instr_start); + + return true; +} + +/* + * serializeAnalyzeStartup - start up the serializeAnalyze receiver + */ +static void +serializeAnalyzeStartup(DestReceiver *self, int operation, TupleDesc typeinfo) +{ + SerializeDestReceiver *receiver = (SerializeDestReceiver *) self; + + Assert(receiver->es != NULL); + + switch (receiver->es->serialize) + { + case EXPLAIN_SERIALIZE_NONE: + Assert(false); + break; + case EXPLAIN_SERIALIZE_TEXT: + receiver->format = 0; /* wire protocol format text */ + break; + case EXPLAIN_SERIALIZE_BINARY: + receiver->format = 1; /* wire protocol format binary */ + break; + } + + /* Create per-row temporary memory context */ + receiver->tmpcontext = AllocSetContextCreate(CurrentMemoryContext, + "SerializeTupleReceive", + ALLOCSET_DEFAULT_SIZES); + + /* The output buffer is re-used across rows, as in printtup.c */ + initStringInfo(&receiver->buf); + + /* Initialize results counters */ + memset(&receiver->metrics, 0, sizeof(SerializeMetrics)); + INSTR_TIME_SET_ZERO(receiver->metrics.timeSpent); +} + +/* + * serializeAnalyzeShutdown - shut down the serializeAnalyze receiver + */ +static void +serializeAnalyzeShutdown(DestReceiver *self) +{ + SerializeDestReceiver *receiver = (SerializeDestReceiver *) self; + + if (receiver->finfos) + pfree(receiver->finfos); + receiver->finfos = NULL; + + if (receiver->buf.data) + pfree(receiver->buf.data); + receiver->buf.data = NULL; + + if (receiver->tmpcontext) + MemoryContextDelete(receiver->tmpcontext); + receiver->tmpcontext = NULL; +} + +/* + * serializeAnalyzeDestroy - destroy the serializeAnalyze receiver + */ +static void +serializeAnalyzeDestroy(DestReceiver *self) +{ + pfree(self); +} + +/* + * Build a DestReceiver for EXPLAIN (SERIALIZE) instrumentation. + */ +DestReceiver * +CreateExplainSerializeDestReceiver(ExplainState *es) +{ + SerializeDestReceiver *self; + + self = (SerializeDestReceiver *) palloc0(sizeof(SerializeDestReceiver)); + + self->pub.receiveSlot = serializeAnalyzeReceive; + self->pub.rStartup = serializeAnalyzeStartup; + self->pub.rShutdown = serializeAnalyzeShutdown; + self->pub.rDestroy = serializeAnalyzeDestroy; + self->pub.mydest = DestExplainSerialize; + + self->es = es; + + return (DestReceiver *) self; +} + +/* + * GetSerializationMetrics - collect metrics + * + * We have to be careful here since the receiver could be an IntoRel + * receiver if the subject statement is CREATE TABLE AS. In that + * case, return all-zeroes stats. + */ +SerializeMetrics +GetSerializationMetrics(DestReceiver *dest) +{ + SerializeMetrics empty; + + if (dest->mydest == DestExplainSerialize) + return ((SerializeDestReceiver *) dest)->metrics; + + memset(&empty, 0, sizeof(SerializeMetrics)); + INSTR_TIME_SET_ZERO(empty.timeSpent); + + return empty; +} diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build index 0d0106ec096..ce8d1ab8bac 100644 --- a/src/backend/commands/meson.build +++ b/src/backend/commands/meson.build @@ -22,6 +22,7 @@ backend_sources += files( 'dropcmds.c', 'event_trigger.c', 'explain.c', + 'explain_dr.c', 'explain_format.c', 'extension.c', 'foreigncmds.c', diff --git a/src/include/commands/explain_dr.h b/src/include/commands/explain_dr.h new file mode 100644 index 00000000000..8f86239b41e --- /dev/null +++ b/src/include/commands/explain_dr.h @@ -0,0 +1,30 @@ +/*------------------------------------------------------------------------- + * + * explain_dr.h + * prototypes for explain_dr.c + * + * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group + * Portions Copyright (c) 1994-5, Regents of the University of California + * + * src/include/commands/explain_dr.h + * + *------------------------------------------------------------------------- + */ +#ifndef EXPLAIN_DR_H +#define EXPLAIN_DR_H + +#include "commands/explain.h" +#include "executor/instrument.h" + +/* Instrumentation data for EXPLAIN's SERIALIZE option */ +typedef struct SerializeMetrics +{ + uint64 bytesSent; /* # of bytes serialized */ + instr_time timeSpent; /* time spent serializing */ + BufferUsage bufferUsage; /* buffers accessed during serialization */ +} SerializeMetrics; + +extern DestReceiver *CreateExplainSerializeDestReceiver(ExplainState *es); +extern SerializeMetrics GetSerializationMetrics(DestReceiver *dest); + +#endif -- 2.39.3 (Apple Git-145) ^ permalink raw reply [nested|flat] 98+ messages in thread
* Re: moving some code out of explain.c @ 2025-02-18 18:11 Peter Geoghegan <[email protected]> parent: Robert Haas <[email protected]> 0 siblings, 1 reply; 98+ messages in thread From: Peter Geoghegan @ 2025-02-18 18:11 UTC (permalink / raw) To: Robert Haas <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]> On Tue, Feb 18, 2025 at 1:04 PM Robert Haas <[email protected]> wrote: > I think in cases like this there is a tendency to want to achieve an > even split of the original file, but in practice I think that tends > not to be difficult to achieve. These two patches combined move about > 1000 lines of code into separate files, which I think is actually > quite a good result for a refactoring of this sort. We might want to > split it up even more, but I don't feel like that has to be done in > the first set of patches or that all such patches have to come from > me. So I propose to do just this much for now. > > Comments? Seems like a good idea to me. -- Peter Geoghegan ^ permalink raw reply [nested|flat] 98+ messages in thread
* Re: moving some code out of explain.c @ 2025-02-27 18:24 Robert Haas <[email protected]> parent: Peter Geoghegan <[email protected]> 0 siblings, 1 reply; 98+ messages in thread From: Robert Haas @ 2025-02-27 18:24 UTC (permalink / raw) To: Peter Geoghegan <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>; Andrew Dunstan <[email protected]> On Tue, Feb 18, 2025 at 1:11 PM Peter Geoghegan <[email protected]> wrote: > On Tue, Feb 18, 2025 at 1:04 PM Robert Haas <[email protected]> wrote: > > I think in cases like this there is a tendency to want to achieve an > > even split of the original file, but in practice I think that tends > > not to be difficult to achieve. These two patches combined move about > > 1000 lines of code into separate files, which I think is actually > > quite a good result for a refactoring of this sort. We might want to > > split it up even more, but I don't feel like that has to be done in > > the first set of patches or that all such patches have to come from > > me. So I propose to do just this much for now. > > > > Comments? > > Seems like a good idea to me. Thanks for the quick response! I have committed these patches. I see that the Redis-FDW test is failing; it will now need to include "commands/explain_format.h" -- unless we something, of course. -- Robert Haas EDB: http://www.enterprisedb.com ^ permalink raw reply [nested|flat] 98+ messages in thread
* Re: moving some code out of explain.c @ 2025-02-27 18:31 Peter Geoghegan <[email protected]> parent: Robert Haas <[email protected]> 0 siblings, 0 replies; 98+ messages in thread From: Peter Geoghegan @ 2025-02-27 18:31 UTC (permalink / raw) To: Robert Haas <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>; Andrew Dunstan <[email protected]> On Thu, Feb 27, 2025 at 1:24 PM Robert Haas <[email protected]> wrote: > Thanks for the quick response! I have committed these patches. I recently did something similar myself when I moved all of the nbtree preprocessing code into its own file. The obvious downside is that it tends to make "git blame" much less useful. It was definitely worth it, though. -- Peter Geoghegan ^ permalink raw reply [nested|flat] 98+ messages in thread
end of thread, other threads:[~2025-02-27 18:31 UTC | newest] Thread overview: 98+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v4 5/5] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v5 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v1 2/3] preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v6 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v3 2/3] preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v10 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v9 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v8 7/8] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2020-10-07 01:40 [PATCH v7 6/7] Preserve indisclustered on children of clustered, partitioned indexes Justin Pryzby <[email protected]> 2025-02-18 18:04 moving some code out of explain.c Robert Haas <[email protected]> 2025-02-18 18:11 ` Re: moving some code out of explain.c Peter Geoghegan <[email protected]> 2025-02-27 18:24 ` Re: moving some code out of explain.c Robert Haas <[email protected]> 2025-02-27 18:31 ` Re: moving some code out of explain.c Peter Geoghegan <[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