summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorPeter Eisentraut2018-02-20 23:03:31 +0000
committerPeter Eisentraut2018-02-23 02:36:48 +0000
commit76b6aa41f41db66004b1c430f17a546d4102fbe7 (patch)
tree3df4add677bd9cc44e9369d2311775a13e76e220 /src/backend/commands
parenta6a80134e3bffa0678a82ed7477d9d46dea07d3a (diff)
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.
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/functioncmds.c25
1 files changed, 4 insertions, 21 deletions
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;