diff options
Diffstat (limited to 'src/backend/optimizer/util/paramassign.c')
-rw-r--r-- | src/backend/optimizer/util/paramassign.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/backend/optimizer/util/paramassign.c b/src/backend/optimizer/util/paramassign.c index 838587c2b8d..536d80a2756 100644 --- a/src/backend/optimizer/util/paramassign.c +++ b/src/backend/optimizer/util/paramassign.c @@ -510,17 +510,12 @@ identify_current_nestloop_params(PlannerInfo *root, Relids leftrelids) { List *result; ListCell *cell; - ListCell *prev; - ListCell *next; result = NIL; - prev = NULL; - for (cell = list_head(root->curOuterParams); cell; cell = next) + foreach(cell, root->curOuterParams) { NestLoopParam *nlp = (NestLoopParam *) lfirst(cell); - next = lnext(cell); - /* * We are looking for Vars and PHVs that can be supplied by the * lefthand rels. The "bms_overlap" test is just an optimization to @@ -529,8 +524,8 @@ identify_current_nestloop_params(PlannerInfo *root, Relids leftrelids) if (IsA(nlp->paramval, Var) && bms_is_member(nlp->paramval->varno, leftrelids)) { - root->curOuterParams = list_delete_cell(root->curOuterParams, - cell, prev); + root->curOuterParams = foreach_delete_current(root->curOuterParams, + cell); result = lappend(result, nlp); } else if (IsA(nlp->paramval, PlaceHolderVar) && @@ -541,12 +536,10 @@ identify_current_nestloop_params(PlannerInfo *root, Relids leftrelids) false)->ph_eval_at, leftrelids)) { - root->curOuterParams = list_delete_cell(root->curOuterParams, - cell, prev); + root->curOuterParams = foreach_delete_current(root->curOuterParams, + cell); result = lappend(result, nlp); } - else - prev = cell; } return result; } |