From ac02c2557f654b9ceaf582f5c79878bec80953a0 Mon Sep 17 00:00:00 2001 From: Richard Guo Date: Fri, 11 Aug 2023 09:08:20 +0800 Subject: [PATCH v1] Simplify create_merge_append_path a bit for clarity --- src/backend/optimizer/util/pathnode.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index 754f0b9f34..dd259322e0 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -1421,11 +1421,16 @@ create_merge_append_path(PlannerInfo *root, Cost input_total_cost; ListCell *l; + /* + * We don't currently support parameterized MergeAppend paths, as explained + * in the comments for generate_orderedappend_paths. + */ + Assert(bms_is_empty(rel->lateral_relids) && bms_is_empty(required_outer)); + pathnode->path.pathtype = T_MergeAppend; pathnode->path.parent = rel; pathnode->path.pathtarget = rel->reltarget; - pathnode->path.param_info = get_appendrel_parampathinfo(rel, - required_outer); + pathnode->path.param_info = NULL; pathnode->path.parallel_aware = false; pathnode->path.parallel_safe = rel->consider_parallel; pathnode->path.parallel_workers = 0; @@ -1451,6 +1456,9 @@ create_merge_append_path(PlannerInfo *root, { Path *subpath = (Path *) lfirst(l); + /* All child paths should be unparameterized */ + Assert(bms_is_empty(PATH_REQ_OUTER(subpath))); + pathnode->path.rows += subpath->rows; pathnode->path.parallel_safe = pathnode->path.parallel_safe && subpath->parallel_safe; @@ -1478,9 +1486,6 @@ create_merge_append_path(PlannerInfo *root, input_startup_cost += sort_path.startup_cost; input_total_cost += sort_path.total_cost; } - - /* All child paths must have same parameterization */ - Assert(bms_equal(PATH_REQ_OUTER(subpath), required_outer)); } /* -- 2.31.0