Skip to content

Commit 74f770e

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 5b5318c commit 74f770e

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
@@ -651,7 +651,7 @@ get_memoize_path(PlannerInfo *root, RelOptInfo *innerrel,
651651
*/
652652
if (extra->inner_unique &&
653653
(inner_path->param_info == NULL ||
654-
list_length(inner_path->param_info->ppi_clauses) <
654+
bms_num_members(inner_path->param_info->ppi_serials) <
655655
list_length(extra->restrictlist)))
656656
return NULL;
657657

0 commit comments

Comments
 (0)