diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index ea2e158f6d428..5379c087a1f01 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -3994,9 +3994,15 @@ reparameterize_path(PlannerInfo *root, Path *path, case T_Memoize: { MemoizePath *mpath = (MemoizePath *) path; + Path *spath = mpath->subpath; + spath = reparameterize_path(root, spath, + required_outer, + loop_count); + if (spath == NULL) + return NULL; return (Path *) create_memoize_path(root, rel, - mpath->subpath, + spath, mpath->param_exprs, mpath->hash_operators, mpath->singlerow,