aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2024-01-22 22:45:33 +1300
committerDavid Rowley <drowley@postgresql.org>2024-01-22 22:45:33 +1300
commit74f770ef202fd3f1f1d1f0889f04c16440d23bd0 (patch)
treefee1c931b8ef1a3bd96c8d0c70dfdf29cdbe470a /src/backend
parent5b5318c387451e3eb89eddb4574e57a61297102f (diff)
downloadpostgresql-74f770ef202fd3f1f1d1f0889f04c16440d23bd0.tar.gz
postgresql-74f770ef202fd3f1f1d1f0889f04c16440d23bd0.zip
Re-disallow Memoize for parameterized nested loops with join filters
This was previously fixed in 9e215378d but got broken again as a result of 2489d76c4. 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 2489d76c4 was introduced.
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/optimizer/path/joinpath.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c
index 4588a4cffc3..9e488ebf455 100644
--- a/src/backend/optimizer/path/joinpath.c
+++ b/src/backend/optimizer/path/joinpath.c
@@ -651,7 +651,7 @@ get_memoize_path(PlannerInfo *root, RelOptInfo *innerrel,
*/
if (extra->inner_unique &&
(inner_path->param_info == NULL ||
- list_length(inner_path->param_info->ppi_clauses) <
+ bms_num_members(inner_path->param_info->ppi_serials) <
list_length(extra->restrictlist)))
return NULL;