postgres.git / summary / log / commit / refs

commit    dd9f55249a642439ee9b1685d5ec33efb982f86d
Author:   David Rowley <drowley@postgresql.org>
Date:     Thu Oct 29 03:21:32 2026 +0000
First released in: 14.25, 15.20, 16.16, 17.12, 18.7, 19.0

    Empty partial_pathlist when unsetting consider_parallel flag
    
    It's not valid for a RelOptInfo to have a non-empty partial_pathlist
    when its consider_parallel is true.  In set_append_rel_pathlist() when
    we see the parent rel doesn't have consider_parallel set, we set that
    property to false for the child.  It is possible that the child already
    has some partial paths at that point, so we need to nullify that list as
    well as set the consider_parallel flag to false.
    
    For the reported problem case, the partial paths had been created during
    set_subquery_pathlist().  These not being empty was causing an Assert
    failure on cassert builds.  I think this could only have gone on to
    result in some wasted planner effort in non-cassert builds, but cannot
    confirm if anything worse could have happened.
    
    Bug: #19803
    Reported-by: Gowtham Reddy <gowthamdoma18@gmail.com>
    Author: David Rowley <dgrowleyml@gmail.com>
    Tested-by: Gowtham Reddy <gowthamdoma18@gmail.com>
    Discussion: https://postgr.es/m/19803-1fcc1df108c54ab6@postgresql.org
    Backpatch-through: 14


src/backend/optimizer/path/allpaths.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index e0c503e2476..7c87516f515 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -1272,10 +1272,15 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, * If set_append_rel_size() decided the parent appendrel was * parallel-unsafe at some point after visiting this child rel, we * need to propagate the unsafety marking down to the child, so that - * we don't generate useless partial paths for it. + * we don't generate useless partial paths for it. Also, zap any + * partial paths that already exist from places such as + * set_subquery_pathlist(). */ if (!rel->consider_parallel) + { + childrel->partial_pathlist = NIL; childrel->consider_parallel = false; + } /* * Compute the child's access paths. [parent: 78bc3b96cce6]