postgres.git / summary / log / commit / refs

commit    b0fa692801d1a0f8d8480bc21d57992a41ee2fd5
Author:   David Rowley <drowley@postgresql.org>
Date:     Thu Oct 29 03:22:17 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 3d9cd5225fd..579f8144253 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -1243,10 +1243,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: 9a56e080f164]