Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/event_trigger.c8
-rw-r--r--src/backend/commands/functioncmds.c15
-rw-r--r--src/backend/commands/tablecmds.c8
-rw-r--r--src/backend/commands/trigger.c12
4 files changed, 22 insertions, 21 deletions
diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c
index 8adc2cadaf4..adb77d8f692 100644
--- a/src/backend/commands/event_trigger.c
+++ b/src/backend/commands/event_trigger.c
@@ -1055,9 +1055,9 @@ EventTriggerInvoke(List *fn_oid_list, EventTriggerData *trigdata)
/* Call each event trigger. */
foreach(lc, fn_oid_list)
{
+ LOCAL_FCINFO(fcinfo, 0);
Oid fnoid = lfirst_oid(lc);
FmgrInfo flinfo;
- FunctionCallInfoData fcinfo;
PgStat_FunctionCallUsage fcusage;
elog(DEBUG1, "EventTriggerInvoke %u", fnoid);
@@ -1077,10 +1077,10 @@ EventTriggerInvoke(List *fn_oid_list, EventTriggerData *trigdata)
fmgr_info(fnoid, &flinfo);
/* Call the function, passing no arguments but setting a context. */
- InitFunctionCallInfoData(fcinfo, &flinfo, 0,
+ InitFunctionCallInfoData(*fcinfo, &flinfo, 0,
InvalidOid, (Node *) trigdata, NULL);
- pgstat_init_function_usage(&fcinfo, &fcusage);
- FunctionCallInvoke(&fcinfo);
+ pgstat_init_function_usage(fcinfo, &fcusage);
+ FunctionCallInvoke(fcinfo);
pgstat_end_function_usage(&fcusage, true);
/* Reclaim memory. */
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index eae2b09830b..ac401689c82 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -2216,13 +2216,13 @@ ExecuteDoStmt(DoStmt *stmt, bool atomic)
void
ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver *dest)
{
+ LOCAL_FCINFO(fcinfo, FUNC_MAX_ARGS);
ListCell *lc;
FuncExpr *fexpr;
int nargs;
int i;
AclResult aclresult;
FmgrInfo flinfo;
- FunctionCallInfoData fcinfo;
CallContext *callcontext;
EState *estate;
ExprContext *econtext;
@@ -2297,7 +2297,8 @@ ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver
InvokeFunctionExecuteHook(fexpr->funcid);
fmgr_info(fexpr->funcid, &flinfo);
fmgr_info_set_expr((Node *) fexpr, &flinfo);
- InitFunctionCallInfoData(fcinfo, &flinfo, nargs, fexpr->inputcollid, (Node *) callcontext, NULL);
+ InitFunctionCallInfoData(*fcinfo, &flinfo, nargs, fexpr->inputcollid,
+ (Node *) callcontext, NULL);
/*
* Evaluate procedure arguments inside a suitable execution context. Note
@@ -2318,14 +2319,14 @@ ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver
val = ExecEvalExprSwitchContext(exprstate, econtext, &isnull);
- fcinfo.arg[i] = val;
- fcinfo.argnull[i] = isnull;
+ fcinfo->args[i].value = val;
+ fcinfo->args[i].isnull = isnull;
i++;
}
- pgstat_init_function_usage(&fcinfo, &fcusage);
- retval = FunctionCallInvoke(&fcinfo);
+ pgstat_init_function_usage(fcinfo, &fcusage);
+ retval = FunctionCallInvoke(fcinfo);
pgstat_end_function_usage(&fcusage, true);
if (fexpr->funcresulttype == VOIDOID)
@@ -2346,7 +2347,7 @@ ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver
TupOutputState *tstate;
TupleTableSlot *slot;
- if (fcinfo.isnull)
+ if (fcinfo->isnull)
elog(ERROR, "procedure returned null record");
td = DatumGetHeapTupleHeader(retval);
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 9daf3e6588f..ff764991379 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8879,7 +8879,7 @@ validateForeignKeyConstraint(char *conname,
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
- FunctionCallInfoData fcinfo;
+ LOCAL_FCINFO(fcinfo, 0);
TriggerData trigdata;
/*
@@ -8887,7 +8887,7 @@ validateForeignKeyConstraint(char *conname,
*
* No parameters are passed, but we do set a context
*/
- MemSet(&fcinfo, 0, sizeof(fcinfo));
+ MemSet(fcinfo, 0, SizeForFunctionCallInfo(0));
/*
* We assume RI_FKey_check_ins won't look at flinfo...
@@ -8901,9 +8901,9 @@ validateForeignKeyConstraint(char *conname,
trigdata.tg_trigtuplebuf = scan->rs_cbuf;
trigdata.tg_newtuplebuf = InvalidBuffer;
- fcinfo.context = (Node *) &trigdata;
+ fcinfo->context = (Node *) &trigdata;
- RI_FKey_check_ins(&fcinfo);
+ RI_FKey_check_ins(fcinfo);
}
heap_endscan(scan);
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 7ffaeaffc67..499030c4455 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -2357,7 +2357,7 @@ ExecCallTriggerFunc(TriggerData *trigdata,
Instrumentation *instr,
MemoryContext per_tuple_context)
{
- FunctionCallInfoData fcinfo;
+ LOCAL_FCINFO(fcinfo, 0);
PgStat_FunctionCallUsage fcusage;
Datum result;
MemoryContext oldContext;
@@ -2402,15 +2402,15 @@ ExecCallTriggerFunc(TriggerData *trigdata,
/*
* Call the function, passing no arguments but setting a context.
*/
- InitFunctionCallInfoData(fcinfo, finfo, 0,
+ InitFunctionCallInfoData(*fcinfo, finfo, 0,
InvalidOid, (Node *) trigdata, NULL);
- pgstat_init_function_usage(&fcinfo, &fcusage);
+ pgstat_init_function_usage(fcinfo, &fcusage);
MyTriggerDepth++;
PG_TRY();
{
- result = FunctionCallInvoke(&fcinfo);
+ result = FunctionCallInvoke(fcinfo);
}
PG_CATCH();
{
@@ -2428,11 +2428,11 @@ ExecCallTriggerFunc(TriggerData *trigdata,
* Trigger protocol allows function to return a null pointer, but NOT to
* set the isnull result flag.
*/
- if (fcinfo.isnull)
+ if (fcinfo->isnull)
ereport(ERROR,
(errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
errmsg("trigger function %u returned null value",
- fcinfo.flinfo->fn_oid)));
+ fcinfo->flinfo->fn_oid)));
/*
* If doing EXPLAIN ANALYZE, stop charging time to this trigger, and count