mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
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.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.274 2009/01/06 01:23:21 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.275 2009/01/09 15:46:10 tgl Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -2018,6 +2018,9 @@ rowtype_field_matches(Oid rowtypeid, int fieldnum,
|
||||
*
|
||||
* NOTE: the planner assumes that this will always flatten nested AND and
|
||||
* OR clauses into N-argument form. See comments in prepqual.c.
|
||||
*
|
||||
* NOTE: another critical effect is that any function calls that require
|
||||
* default arguments will be expanded.
|
||||
*--------------------
|
||||
*/
|
||||
Node *
|
||||
@@ -3854,10 +3857,14 @@ evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod)
|
||||
/* We can use the estate's working context to avoid memory leaks. */
|
||||
oldcontext = MemoryContextSwitchTo(estate->es_query_cxt);
|
||||
|
||||
/* Make sure any opfuncids are filled in. */
|
||||
fix_opfuncids((Node *) expr);
|
||||
|
||||
/*
|
||||
* Prepare expr for execution.
|
||||
* Prepare expr for execution. (Note: we can't use ExecPrepareExpr
|
||||
* because it'd result in recursively invoking eval_const_expressions.)
|
||||
*/
|
||||
exprstate = ExecPrepareExpr(expr, estate);
|
||||
exprstate = ExecInitExpr(expr, NULL);
|
||||
|
||||
/*
|
||||
* And evaluate it.
|
||||
|
||||
Reference in New Issue
Block a user