aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2021-10-01 15:09:49 +1300
committerDavid Rowley <drowley@postgresql.org>2021-10-01 15:09:49 +1300
commit16239c5fdf6e457f8274c49209d1fbdeab472703 (patch)
tree654d438c5a186b9c9cfb8483b1e700cc73334b07
parent20f8671ef69b864c25ffa59471814102c1260d78 (diff)
downloadpostgresql-16239c5fdf6e457f8274c49209d1fbdeab472703.tar.gz
postgresql-16239c5fdf6e457f8274c49209d1fbdeab472703.zip
Ensure interleaved_parts field is always initialized
This field was recently added in db632fbca, however that commit missed one place where it should have initialized the new field to NULL. The missed location is where the PartitionBoundInfo is created for partition-wise join relations. Technically there could be interleaved partitions in a partition-wise join relation, but currently the only optimization we use this field for only does so for base rels and other member rels. So just document that we don't populate this field for join rels. Reported-by: Amit Langote Author: Amit Langote, David Rowley Reviewed-by: Amit Langote, David Rowley Discussion: https://postgr.es/m/CA+HiwqE76Rps24kwHsd2Cr82Ua07tJC9t9reG0c7ScX9n_xrEA@mail.gmail.com
-rw-r--r--src/backend/partitioning/partbounds.c3
-rw-r--r--src/include/partitioning/partbounds.h4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/partitioning/partbounds.c b/src/backend/partitioning/partbounds.c
index fdfe712f917..95798f4f664 100644
--- a/src/backend/partitioning/partbounds.c
+++ b/src/backend/partitioning/partbounds.c
@@ -2564,6 +2564,9 @@ build_merged_partition_bounds(char strategy, List *merged_datums,
merged_bounds->kind = NULL;
}
+ /* interleaved_parts is always NULL for join relations. */
+ merged_bounds->interleaved_parts = NULL;
+
Assert(list_length(merged_indexes) == ndatums);
merged_bounds->nindexes = ndatums;
merged_bounds->indexes = (int *) palloc(sizeof(int) * ndatums);
diff --git a/src/include/partitioning/partbounds.h b/src/include/partitioning/partbounds.h
index 9db546def6b..7138cb1f2ab 100644
--- a/src/include/partitioning/partbounds.h
+++ b/src/include/partitioning/partbounds.h
@@ -72,7 +72,9 @@ struct RelOptInfo; /* avoid including pathnodes.h here */
* contain any value that does not belong in another partition. This field
* only serves as proof that a particular partition is not interleaved, not
* proof that it is interleaved. When we're uncertain, we marked the
- * partition as interleaved.
+ * partition as interleaved. The interleaved_parts field is only ever set for
+ * RELOPT_BASEREL and RELOPT_OTHER_MEMBER_REL, it is always left NULL for join
+ * relations.
*/
typedef struct PartitionBoundInfoData
{