*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.90 2003/10/13 20:02:52 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.91 2003/10/13 22:47:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Relation pkrel)
{
HeapScanDesc scan;
- TriggerData *trigdata = makeNode(TriggerData); /* must be Node aligned */
HeapTuple tuple;
Trigger trig;
List *list;
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
FunctionCallInfoData fcinfo;
+ TriggerData trigdata;
/*
* Make a call to the trigger function
/*
* We assume RI_FKey_check_ins won't look at flinfo...
*/
- trigdata->type = T_TriggerData;
- trigdata->tg_event = TRIGGER_EVENT_INSERT | TRIGGER_EVENT_ROW;
- trigdata->tg_relation = rel;
- trigdata->tg_trigtuple = tuple;
- trigdata->tg_newtuple = NULL;
- trigdata->tg_trigger = &trig;
+ trigdata.type = T_TriggerData;
+ trigdata.tg_event = TRIGGER_EVENT_INSERT | TRIGGER_EVENT_ROW;
+ trigdata.tg_relation = rel;
+ trigdata.tg_trigtuple = tuple;
+ trigdata.tg_newtuple = NULL;
+ trigdata.tg_trigger = &trig;
- fcinfo.context = (Node *) trigdata;
+ fcinfo.context = (Node *) &trigdata;
RI_FKey_check_ins(&fcinfo);
}
heap_endscan(scan);
- pfree(trigdata);
pfree(trig.tgargs);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.149 2003/10/12 23:19:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.150 2003/10/13 22:47:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
List *arguments = fcache->args;
Datum result;
FunctionCallInfoData fcinfo;
- /* for functions returning sets, must be aligned as Node, so use makeNode */
- ReturnSetInfo *rsinfo = makeNode(ReturnSetInfo);
+ ReturnSetInfo rsinfo; /* for functions returning sets */
ExprDoneCond argDone;
bool hasSetArg;
int i;
*/
if (fcache->func.fn_retset)
{
- fcinfo.resultinfo = (Node *) rsinfo;
- rsinfo->type = T_ReturnSetInfo;
- rsinfo->econtext = econtext;
- rsinfo->expectedDesc = NULL;
- rsinfo->allowedModes = (int) SFRM_ValuePerCall;
- rsinfo->returnMode = SFRM_ValuePerCall;
+ fcinfo.resultinfo = (Node *) &rsinfo;
+ rsinfo.type = T_ReturnSetInfo;
+ rsinfo.econtext = econtext;
+ rsinfo.expectedDesc = NULL;
+ rsinfo.allowedModes = (int) SFRM_ValuePerCall;
+ rsinfo.returnMode = SFRM_ValuePerCall;
/* isDone is filled below */
- rsinfo->setResult = NULL;
- rsinfo->setDesc = NULL;
+ rsinfo.setResult = NULL;
+ rsinfo.setDesc = NULL;
}
/*
if (callit)
{
fcinfo.isnull = false;
- rsinfo->isDone = ExprSingleResult;
+ rsinfo.isDone = ExprSingleResult;
result = FunctionCallInvoke(&fcinfo);
*isNull = fcinfo.isnull;
- *isDone = rsinfo->isDone;
+ *isDone = rsinfo.isDone;
}
else
{
TupleDesc tupdesc = NULL;
Oid funcrettype;
FunctionCallInfoData fcinfo;
- ReturnSetInfo *rsinfo = makeNode(ReturnSetInfo); /* must be Node aligned */
+ ReturnSetInfo rsinfo;
MemoryContext callerContext;
MemoryContext oldcontext;
TupleTableSlot *slot;
* doesn't actually get to see the resultinfo, but set it up anyway
* because we use some of the fields as our own state variables.
*/
- fcinfo.resultinfo = (Node *) rsinfo;
- rsinfo->type = T_ReturnSetInfo;
- rsinfo->econtext = econtext;
- rsinfo->expectedDesc = expectedDesc;
- rsinfo->allowedModes = (int) (SFRM_ValuePerCall | SFRM_Materialize);
- rsinfo->returnMode = SFRM_ValuePerCall;
+ fcinfo.resultinfo = (Node *) &rsinfo;
+ rsinfo.type = T_ReturnSetInfo;
+ rsinfo.econtext = econtext;
+ rsinfo.expectedDesc = expectedDesc;
+ rsinfo.allowedModes = (int) (SFRM_ValuePerCall | SFRM_Materialize);
+ rsinfo.returnMode = SFRM_ValuePerCall;
/* isDone is filled below */
- rsinfo->setResult = NULL;
- rsinfo->setDesc = NULL;
+ rsinfo.setResult = NULL;
+ rsinfo.setDesc = NULL;
/*
* Switch to short-lived context for calling the function or
if (direct_function_call)
{
fcinfo.isnull = false;
- rsinfo->isDone = ExprSingleResult;
+ rsinfo.isDone = ExprSingleResult;
result = FunctionCallInvoke(&fcinfo);
}
else
{
result = ExecEvalExpr(funcexpr, econtext,
- &fcinfo.isnull, &rsinfo->isDone);
+ &fcinfo.isnull, &rsinfo.isDone);
}
/* Which protocol does function want to use? */
- if (rsinfo->returnMode == SFRM_ValuePerCall)
+ if (rsinfo.returnMode == SFRM_ValuePerCall)
{
/*
* Check for end of result set.
* tupdesc or tuplestore (since we can't get a tupdesc in the
* function-returning-tuple case)
*/
- if (rsinfo->isDone == ExprEndResult)
+ if (rsinfo.isDone == ExprEndResult)
break;
/*
}
tupstore = tuplestore_begin_heap(true, false, SortMem);
MemoryContextSwitchTo(oldcontext);
- rsinfo->setResult = tupstore;
- rsinfo->setDesc = tupdesc;
+ rsinfo.setResult = tupstore;
+ rsinfo.setDesc = tupdesc;
}
/*
/*
* Are we done?
*/
- if (rsinfo->isDone != ExprMultipleResult)
+ if (rsinfo.isDone != ExprMultipleResult)
break;
}
- else if (rsinfo->returnMode == SFRM_Materialize)
+ else if (rsinfo.returnMode == SFRM_Materialize)
{
/* check we're on the same page as the function author */
- if (!first_time || rsinfo->isDone != ExprSingleResult)
+ if (!first_time || rsinfo.isDone != ExprSingleResult)
ereport(ERROR,
(errcode(ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED),
errmsg("table-function protocol for materialize mode was not followed")));
ereport(ERROR,
(errcode(ERRCODE_E_R_I_E_SRF_PROTOCOL_VIOLATED),
errmsg("unrecognized table-function returnMode: %d",
- (int) rsinfo->returnMode)));
+ (int) rsinfo.returnMode)));
first_time = false;
}
MemoryContextSwitchTo(callerContext);
/* The returned pointers are those in rsinfo */
- *returnDesc = rsinfo->setDesc;
- return rsinfo->setResult;
+ *returnDesc = rsinfo.setDesc;
+ return rsinfo.setResult;
}