indexed_tlist *subplan_itlist;
int newvarno;
int rtoffset;
- NullingRelsMatch nrm_match;
double num_exec;
} fix_upper_expr_context;
indexed_tlist *subplan_itlist,
int newvarno,
int rtoffset,
- NullingRelsMatch nrm_match,
double num_exec);
static Node *fix_upper_expr_mutator(Node *node,
fix_upper_expr_context *context);
index_itlist,
INDEX_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_TLIST((Plan *) plan));
plan->scan.plan.qual = (List *)
fix_upper_expr(root,
index_itlist,
INDEX_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_QUAL((Plan *) plan));
plan->recheckqual = (List *)
fix_upper_expr(root,
index_itlist,
INDEX_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_QUAL((Plan *) plan));
/* indexqual is already transformed to reference index columns */
plan->indexqual = fix_scan_list(root, plan->indexqual,
itlist,
INDEX_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_TLIST((Plan *) fscan));
fscan->scan.plan.qual = (List *)
fix_upper_expr(root,
itlist,
INDEX_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_QUAL((Plan *) fscan));
fscan->fdw_exprs = (List *)
fix_upper_expr(root,
itlist,
INDEX_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_QUAL((Plan *) fscan));
fscan->fdw_recheck_quals = (List *)
fix_upper_expr(root,
itlist,
INDEX_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_QUAL((Plan *) fscan));
pfree(itlist);
/* fdw_scan_tlist itself just needs fix_scan_list() adjustments */
itlist,
INDEX_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_TLIST((Plan *) cscan));
cscan->scan.plan.qual = (List *)
fix_upper_expr(root,
itlist,
INDEX_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_QUAL((Plan *) cscan));
cscan->custom_exprs = (List *)
fix_upper_expr(root,
itlist,
INDEX_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_QUAL((Plan *) cscan));
pfree(itlist);
/* custom_scan_tlist itself just needs fix_scan_list() adjustments */
outer_itlist,
OUTER_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_QUAL(plan));
/* Hash doesn't project */
* Vars or PHVs seen in the NestLoopParam expression have
* nullingrels that include exactly the outer-join relids that
* appear in the outer side's output and can null the respective
- * Var or PHV. So we can use exact nullingrels matches for the
- * NestLoopParam expression.
+ * Var or PHV. Therefore, fix_upper_expr will not complain when
+ * performing the nullingrels matches here.
*/
nlp->paramval = (Var *) fix_upper_expr(root,
(Node *) nlp->paramval,
outer_itlist,
OUTER_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_TLIST(outer_plan));
/* Check we replaced any PlaceHolderVar with simple Var */
if (!(IsA(nlp->paramval, Var) &&
outer_itlist,
OUTER_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_QUAL((Plan *) join));
}
subplan_itlist,
OUTER_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_TLIST(plan));
}
else
subplan_itlist,
OUTER_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_TLIST(plan));
tle = flatCopyTargetEntry(tle);
tle->expr = (Expr *) newexpr;
subplan_itlist,
OUTER_VAR,
rtoffset,
- NRM_EQUAL,
NUM_EXEC_QUAL(plan));
pfree(subplan_itlist);
* expensive, so we don't want to try it in the common case where the
* subplan tlist is just a flattened list of Vars.)
*
+ * When cross-checking the nullingrels of the subplan output Vars/PHVs, we
+ * always expect exact matches.
+ *
* 'node': the tree to be fixed (a target item or qual)
* 'subplan_itlist': indexed target list for subplan (or index)
* 'newvarno': varno to use for Vars referencing tlist elements
* 'rtoffset': how much to increment varnos by
- * 'nrm_match': as for search_indexed_tlist_for_var()
* 'num_exec': estimated number of executions of expression
*
* The resulting tree is a copy of the original in which all Var nodes have
indexed_tlist *subplan_itlist,
int newvarno,
int rtoffset,
- NullingRelsMatch nrm_match,
double num_exec)
{
fix_upper_expr_context context;
context.subplan_itlist = subplan_itlist;
context.newvarno = newvarno;
context.rtoffset = rtoffset;
- context.nrm_match = nrm_match;
context.num_exec = num_exec;
return fix_upper_expr_mutator(node, &context);
}
context->subplan_itlist,
context->newvarno,
context->rtoffset,
- context->nrm_match);
+ NRM_EQUAL);
if (!newvar)
elog(ERROR, "variable not found in subplan target list");
return (Node *) newvar;
newvar = search_indexed_tlist_for_phv(phv,
context->subplan_itlist,
context->newvarno,
- context->nrm_match);
+ NRM_EQUAL);
if (newvar)
return (Node *) newvar;
}