diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index 3364589391..89c273e6cd 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -2024,8 +2024,8 @@ get_cheapest_parameterized_child_path(PlannerInfo *root, RelOptInfo *rel, required_outer, TOTAL_COST, false); - Assert(cheapest != NULL); - if (bms_equal(PATH_REQ_OUTER(cheapest), required_outer)) + + if (cheapest != NULL && bms_equal(PATH_REQ_OUTER(cheapest), required_outer)) return cheapest; /*