From 76b6aa41f41db66004b1c430f17a546d4102fbe7 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 20 Feb 2018 18:03:31 -0500 Subject: Support parameters in CALL To support parameters in CALL, move the parse analysis of the procedure and arguments into the global transformation phase, so that the parser hooks can be applied. And then at execution time pass the parameters from ProcessUtility on to ExecuteCallStmt. --- src/backend/commands/functioncmds.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) (limited to 'src/backend/commands/functioncmds.c') diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index a027b19744a..abdfa249c01 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -2212,11 +2212,9 @@ ExecuteDoStmt(DoStmt *stmt, bool atomic) * commits that might occur inside the procedure. */ void -ExecuteCallStmt(ParseState *pstate, CallStmt *stmt, bool atomic) +ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic) { - List *targs; ListCell *lc; - Node *node; FuncExpr *fexpr; int nargs; int i; @@ -2228,24 +2226,8 @@ ExecuteCallStmt(ParseState *pstate, CallStmt *stmt, bool atomic) ExprContext *econtext; HeapTuple tp; - /* We need to do parse analysis on the procedure call and its arguments */ - targs = NIL; - foreach(lc, stmt->funccall->args) - { - targs = lappend(targs, transformExpr(pstate, - (Node *) lfirst(lc), - EXPR_KIND_CALL_ARGUMENT)); - } - - node = ParseFuncOrColumn(pstate, - stmt->funccall->funcname, - targs, - pstate->p_last_srf, - stmt->funccall, - true, - stmt->funccall->location); - - fexpr = castNode(FuncExpr, node); + fexpr = stmt->funcexpr; + Assert(fexpr); aclresult = pg_proc_aclcheck(fexpr->funcid, GetUserId(), ACL_EXECUTE); if (aclresult != ACLCHECK_OK) @@ -2289,6 +2271,7 @@ ExecuteCallStmt(ParseState *pstate, CallStmt *stmt, bool atomic) * we can't free this context till the procedure returns. */ estate = CreateExecutorState(); + estate->es_param_list_info = params; econtext = CreateExprContext(estate); i = 0; -- cgit v1.2.3