summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/joinpath.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-12-05 12:36:40 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2022-12-05 12:36:40 -0500
commitd69d01ba9d8d774487032459ebb83d2086715f01 (patch)
tree76b2daf0834bd0902041fa34d10eed34a38ccf82 /src/backend/optimizer/path/joinpath.c
parent35ce24c333cf6dee3c92bc5f67553c7720bd9988 (diff)
downloadpostgresql-d69d01ba9d8d774487032459ebb83d2086715f01.tar.gz
Fix Memoize to work with partitionwise joining.
A couple of places weren't up to speed for this. By sheer good luck, we didn't fail but just selected a non-memoized join plan, at least in the test case we have. Nonetheless, it's a bug, and I'm not quite sure that it couldn't have worse consequences in other examples. So back-patch to v14 where Memoize came in. Richard Guo Discussion: https://postgr.es/m/CAMbWs48GkNom272sfp0-WeD6_0HSR19BJ4H1c9ZKSfbVnJsvRg@mail.gmail.com
Diffstat (limited to 'src/backend/optimizer/path/joinpath.c')
-rw-r--r--src/backend/optimizer/path/joinpath.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c
index 2a3f0ab7bf..4d09881259 100644
--- a/src/backend/optimizer/path/joinpath.c
+++ b/src/backend/optimizer/path/joinpath.c
@@ -597,7 +597,8 @@ get_memoize_path(PlannerInfo *root, RelOptInfo *innerrel,
/* Check if we have hash ops for each parameter to the path */
if (paraminfo_get_equal_hashops(root,
inner_path->param_info,
- outerrel,
+ outerrel->top_parent ?
+ outerrel->top_parent : outerrel,
innerrel,
&param_exprs,
&hash_operators,