diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-11-26 03:01:59 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-11-26 03:01:59 +0000 |
commit | ea0b5c856922c08ef2ce6e2eb26f6c68d20bf957 (patch) | |
tree | d4e59a1b466aaf615adc9d513fbd5d00e87cd388 /src/backend/executor/nodeSubplan.c | |
parent | ac47950238480321862c3a0b66cb01c40af801db (diff) | |
download | postgresql-ea0b5c856922c08ef2ce6e2eb26f6c68d20bf957.tar.gz postgresql-ea0b5c856922c08ef2ce6e2eb26f6c68d20bf957.zip |
Use Params, rather than run-time-modified Const nodes, to handle
sublink results and COPY's domain constraint checking. A Const that
isn't really constant is just a Bad Idea(tm). Remove hacks in
parse_coerce and other places that were needed because of the former
klugery.
Diffstat (limited to 'src/backend/executor/nodeSubplan.c')
-rw-r--r-- | src/backend/executor/nodeSubplan.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c index 0c7b3557cff..73ff6370fbc 100644 --- a/src/backend/executor/nodeSubplan.c +++ b/src/backend/executor/nodeSubplan.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.33 2002/06/20 20:29:28 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.34 2002/11/26 03:01:57 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -150,37 +150,44 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext, bool *isNull) foreach(lst, sublink->oper) { Expr *expr = (Expr *) lfirst(lst); - Const *con = lsecond(expr->args); + Param *prm = lsecond(expr->args); + ParamExecData *prmdata; Datum expresult; bool expnull; /* * The righthand side of the expression should be either a - * Const or a function call or RelabelType node taking a Const + * Param or a function call or RelabelType node taking a Param * as arg (these nodes represent run-time type coercions * inserted by the parser to get to the input type needed by - * the operator). Find the Const node and insert the actual - * righthand-side value into it. + * the operator). Find the Param node and insert the actual + * righthand-side value into the param's econtext slot. + * + * XXX possible improvement: could make a list of the ParamIDs + * at startup time, instead of repeating this check at each row. */ - if (!IsA(con, Const)) + if (!IsA(prm, Param)) { - switch (con->type) + switch (nodeTag(prm)) { case T_Expr: - con = lfirst(((Expr *) con)->args); + prm = lfirst(((Expr *) prm)->args); break; case T_RelabelType: - con = (Const *) (((RelabelType *) con)->arg); + prm = (Param *) (((RelabelType *) prm)->arg); break; default: /* will fail below */ break; } - if (!IsA(con, Const)) + if (!IsA(prm, Param)) elog(ERROR, "ExecSubPlan: failed to find placeholder for subplan result"); } - con->constvalue = heap_getattr(tup, col, tdesc, - &(con->constisnull)); + Assert(prm->paramkind == PARAM_EXEC); + prmdata = &(econtext->ecxt_param_exec_vals[prm->paramid]); + Assert(prmdata->execPlan == NULL); + prmdata->value = heap_getattr(tup, col, tdesc, + &(prmdata->isnull)); /* * Now we can eval the combining operator for this column. |