1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Use makeNode() to allocate structures that have to be cast to Node *,

rather than allocating them on the stack.

Fixes complaint from gcc 3.3.1.
This commit is contained in:
Bruce Momjian
2003-10-12 23:19:21 +00:00
parent 037468eff2
commit 4a2c34d4a0
3 changed files with 46 additions and 44 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.88 2003/10/11 18:04:25 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.89 2003/10/12 23:19:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -3449,6 +3449,7 @@ validateForeignKeyConstraint(FkConstraint *fkconstraint,
Relation pkrel)
{
HeapScanDesc scan;
TriggerData *trigdata = makeNode(TriggerData); /* must be Node aligned */
HeapTuple tuple;
Trigger trig;
List *list;
@ -3506,7 +3507,6 @@ validateForeignKeyConstraint(FkConstraint *fkconstraint,
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
FunctionCallInfoData fcinfo;
TriggerData trigdata;
/*
* Make a call to the trigger function
@ -3518,20 +3518,21 @@ validateForeignKeyConstraint(FkConstraint *fkconstraint,
/*
* 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);
}