Skip to content

Commit 99c5852

Browse files
committed
Add missing NULL check when building Result Cache paths
Code added in 9e21537 to disable building of Result Cache paths when not all join conditions are part of the parameterization of a unique join failed to first check if the inner path's param_info was set before checking the param_info's ppi_clauses. Add a check for NULL values here and just bail on trying to build the path if param_info is NULL. lateral_vars are not considered when deciding if the join is unique, so we're not missing out on doing the optimization when there are lateral_vars and no param_info. Reported-by: Coverity, via Tom Lane Discussion: https://postgr.es/m/457998.1621779290@sss.pgh.pa.us
1 parent f5024d8 commit 99c5852

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/optimizer/path/joinpath.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,9 @@ get_resultcache_path(PlannerInfo *root, RelOptInfo *innerrel,
530530
* considering doing that?
531531
*/
532532
if (extra->inner_unique &&
533-
list_length(inner_path->param_info->ppi_clauses) <
534-
list_length(extra->restrictlist))
533+
(inner_path->param_info == NULL ||
534+
list_length(inner_path->param_info->ppi_clauses) <
535+
list_length(extra->restrictlist)))
535536
return NULL;
536537

537538
/*

0 commit comments

Comments
 (0)