summaryrefslogtreecommitdiff
path: root/src/backend/optimizer
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer')
-rw-r--r--src/backend/optimizer/plan/createplan.c12
-rw-r--r--src/backend/optimizer/util/pathnode.c18
2 files changed, 12 insertions, 18 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index fa09a6103b..910ffbf1e1 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -1531,16 +1531,8 @@ create_merge_append_plan(PlannerInfo *root, MergeAppendPath *best_path,
prunequal = extract_actual_clauses(rel->baserestrictinfo, false);
- if (best_path->path.param_info)
- {
- List *prmquals = best_path->path.param_info->ppi_clauses;
-
- prmquals = extract_actual_clauses(prmquals, false);
- prmquals = (List *) replace_nestloop_params(root,
- (Node *) prmquals);
-
- prunequal = list_concat(prunequal, prmquals);
- }
+ /* We don't currently generate any parameterized MergeAppend paths */
+ Assert(best_path->path.param_info == NULL);
if (prunequal != NIL)
node->part_prune_index = make_partition_pruneinfo(root, rel,
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index e8e06397a9..65a191ebfd 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -1256,15 +1256,17 @@ create_append_path(PlannerInfo *root,
pathnode->path.pathtarget = rel->reltarget;
/*
- * When generating an Append path for a partitioned table, there may be
- * parameterized quals that are useful for run-time pruning. Hence,
- * compute path.param_info the same way as for any other baserel, so that
- * such quals will be available for make_partition_pruneinfo(). (This
- * would not work right for a non-baserel, ie a scan on a non-leaf child
- * partition, and it's not necessary anyway in that case. Must skip it if
- * we don't have "root", too.)
+ * If this is for a baserel (not a join or non-leaf partition), we prefer
+ * to apply get_baserel_parampathinfo to construct a full ParamPathInfo
+ * for the path. This supports building a Memoize path atop this path,
+ * and if this is a partitioned table the info may be useful for run-time
+ * pruning (cf make_partition_pruneinfo()).
+ *
+ * However, if we don't have "root" then that won't work and we fall back
+ * on the simpler get_appendrel_parampathinfo. There's no point in doing
+ * the more expensive thing for a dummy path, either.
*/
- if (root && rel->reloptkind == RELOPT_BASEREL && IS_PARTITIONED_REL(rel))
+ if (rel->reloptkind == RELOPT_BASEREL && root && subpaths != NIL)
pathnode->path.param_info = get_baserel_parampathinfo(root,
rel,
required_outer);