From 896221df304acf788e8f970bd7af4295ee20a50b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E6=8C=83?= Date: Mon, 12 Apr 2021 10:37:43 +0800 Subject: [PATCH v1 1/2] Document enhancement for RelOptInfo.partexprs & nullable_partexprs. Also use more explicit way to add RelOptInfo.all_partrels member in expand_partitioned_rtentry. --- src/backend/optimizer/util/inherit.c | 4 ++-- src/include/nodes/pathnodes.h | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/backend/optimizer/util/inherit.c b/src/backend/optimizer/util/inherit.c index 13f67ab744..0dac3ea3ee 100644 --- a/src/backend/optimizer/util/inherit.c +++ b/src/backend/optimizer/util/inherit.c @@ -380,8 +380,8 @@ expand_partitioned_rtentry(PlannerInfo *root, RelOptInfo *relinfo, /* Create the otherrel RelOptInfo too. */ childrelinfo = build_simple_rel(root, childRTindex, relinfo); relinfo->part_rels[i] = childrelinfo; - relinfo->all_partrels = bms_add_members(relinfo->all_partrels, - childrelinfo->relids); + relinfo->all_partrels = bms_add_member(relinfo->all_partrels, + childRTindex); /* If this child is itself partitioned, recurse */ if (childrel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h index a65bda7e3c..06c74fe5e9 100644 --- a/src/include/nodes/pathnodes.h +++ b/src/include/nodes/pathnodes.h @@ -763,8 +763,15 @@ typedef struct RelOptInfo struct RelOptInfo **part_rels; /* Array of RelOptInfos of partitions, * stored in the same order as bounds */ Relids all_partrels; /* Relids set of all partition relids */ - List **partexprs; /* Non-nullable partition key expressions */ - List **nullable_partexprs; /* Nullable partition key expressions */ + List **partexprs; /* Non-nullable partition key expressions, + * Base Relations have a single expression per key, + */ + List **nullable_partexprs; /* Nullable partition key expressions, + * Base Relations doesn't have such exprs + * since no outer join is involved. + * Check set_baserel_partition_key_exprs for + * more information. + */ } RelOptInfo; /* -- 2.21.0