diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-01-09 15:46:11 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-01-09 15:46:11 +0000 |
commit | d04db370720ece56ffcad54e46cf03483c742ebb (patch) | |
tree | f446fa524bfef45b5152575dc188e49c43ea0a25 /src/backend/executor | |
parent | d3706cb6d217bc9c4676541f2df32171ef6555a2 (diff) | |
download | postgresql-d04db370720ece56ffcad54e46cf03483c742ebb.tar.gz postgresql-d04db370720ece56ffcad54e46cf03483c742ebb.zip |
Arrange for function default arguments to be processed properly in expressions
that are set up for execution with ExecPrepareExpr rather than going through
the full planner process. By introducing an explicit notion of "expression
planning", this patch also lays a bit of groundwork for maybe someday
allowing sub-selects in standalone expressions.
Diffstat (limited to 'src/backend/executor')
-rw-r--r-- | src/backend/executor/README | 5 | ||||
-rw-r--r-- | src/backend/executor/execQual.c | 17 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/backend/executor/README b/src/backend/executor/README index 7644cc2cc42..467d6272d1e 100644 --- a/src/backend/executor/README +++ b/src/backend/executor/README @@ -1,4 +1,4 @@ -$PostgreSQL: pgsql/src/backend/executor/README,v 1.7 2008/03/21 13:23:28 momjian Exp $ +$PostgreSQL: pgsql/src/backend/executor/README,v 1.8 2009/01/09 15:46:10 tgl Exp $ The Postgres Executor ===================== @@ -124,7 +124,8 @@ be hidden inside function calls). This case has a flow of control like creates per-tuple context ExecPrepareExpr - switch to per-query context to run ExecInitExpr + temporarily switch to per-query context + run the expression through expression_planner ExecInitExpr Repeatedly do: diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c index ed53a62e383..f74a5da6b28 100644 --- a/src/backend/executor/execQual.c +++ b/src/backend/executor/execQual.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.240 2009/01/01 17:23:41 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.241 2009/01/09 15:46:10 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -45,7 +45,7 @@ #include "miscadmin.h" #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" -#include "optimizer/planmain.h" +#include "optimizer/planner.h" #include "pgstat.h" #include "utils/acl.h" #include "utils/builtins.h" @@ -4794,10 +4794,11 @@ ExecInitExpr(Expr *node, PlanState *parent) * Plan tree context. * * This differs from ExecInitExpr in that we don't assume the caller is - * already running in the EState's per-query context. Also, we apply - * fix_opfuncids() to the passed expression tree to be sure it is ready - * to run. (In ordinary Plan trees the planner will have fixed opfuncids, - * but callers outside the executor will not have done this.) + * already running in the EState's per-query context. Also, we run the + * passed expression tree through expression_planner() to prepare it for + * execution. (In ordinary Plan trees the regular planning process will have + * made the appropriate transformations on expressions, but for standalone + * expressions this won't have happened.) */ ExprState * ExecPrepareExpr(Expr *node, EState *estate) @@ -4805,10 +4806,10 @@ ExecPrepareExpr(Expr *node, EState *estate) ExprState *result; MemoryContext oldcontext; - fix_opfuncids((Node *) node); - oldcontext = MemoryContextSwitchTo(estate->es_query_cxt); + node = expression_planner(node); + result = ExecInitExpr(node, NULL); MemoryContextSwitchTo(oldcontext); |