Skip to content

Commit 2bcf078

Browse files
committed
Re-disallow Memoize for parameterized nested loops with join filters
This was previously fixed in 9e21537 but got broken again as a result of 2489d76. It seems that commit causes ppi_clauses to contain duplicate clauses and it's no longer safe to check the list_length of that list to determine if there are join conditions other than what's mentioned in ppi_clauses. Here we adjust the check to count the distinct rinfo_serial mentioned in ppi_clauses. We expect that extra->restrictlist won't have duplicate rinfo_serials. Reported-by: Amadeo Gallardo Author: Richard Guo Discussion: https://postgr.es/m/CADFREbW-BLJd7-a5J%2B5wjVumeFG1ByXiSOFzMtkmY_SDWckTxw%40mail.gmail.com Backpatch-through: 16, where 2489d76 was introduced.
1 parent b199eb8 commit 2bcf078

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/optimizer/path/joinpath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ get_memoize_path(PlannerInfo *root, RelOptInfo *innerrel,
635635
*/
636636
if (extra->inner_unique &&
637637
(inner_path->param_info == NULL ||
638-
list_length(inner_path->param_info->ppi_clauses) <
638+
bms_num_members(inner_path->param_info->ppi_serials) <
639639
list_length(extra->restrictlist)))
640640
return NULL;
641641

0 commit comments

Comments
 (0)