Index: src/backend/commands/trigger.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/commands/trigger.c,v retrieving revision 1.145 diff -c -r1.145 trigger.c *** src/backend/commands/trigger.c 2003/02/09 06:56:26 1.145 --- src/backend/commands/trigger.c 2003/03/25 17:05:43 *************** *** 15,20 **** --- 15,21 ---- #include "access/genam.h" #include "access/heapam.h" + #include "access/xact.h" #include "catalog/catalog.h" #include "catalog/catname.h" #include "catalog/dependency.h" *************** *** 1594,1607 **** */ ! /* ---------- ! * Internal data to the deferred trigger mechanism is held ! * during entire session in a global context created at startup and ! * over statements/commands in a separate context which ! * is created at transaction start and destroyed at transaction end. ! * ---------- */ ! static MemoryContext deftrig_gcxt = NULL; static MemoryContext deftrig_cxt = NULL; /* ---------- --- 1595,1606 ---- */ ! /* ! * Internal data to the deferred trigger mechanism is held over ! * statements/commands in a context which is created at transaction ! * start and destroyed at transaction end. */ ! static MemoryContext deftrig_cxt = NULL; /* ---------- *************** *** 1609,1616 **** * state IMMEDIATE or DEFERRED. * ---------- */ - static List *deftrig_dfl_trigstates = NIL; - static bool deftrig_all_isset = false; static bool deftrig_all_isdeferred = false; static List *deftrig_trigstates; --- 1608,1613 ---- *************** *** 2010,2020 **** void DeferredTriggerInit(void) { ! deftrig_gcxt = AllocSetContextCreate(TopMemoryContext, ! "DeferredTriggerSession", ! ALLOCSET_DEFAULT_MINSIZE, ! ALLOCSET_DEFAULT_INITSIZE, ! ALLOCSET_DEFAULT_MAXSIZE); } --- 2007,2014 ---- void DeferredTriggerInit(void) { ! /* Nothing to do */ ! ; } *************** *** 2028,2053 **** void DeferredTriggerBeginXact(void) { - MemoryContext oldcxt; - List *l; - DeferredTriggerStatus dflstat; - DeferredTriggerStatus stat; - if (deftrig_cxt != NULL) elog(ERROR, "DeferredTriggerBeginXact() called while inside transaction"); /* ! * Create the per transaction memory context and copy all states from ! * the per session context to here. */ ! deftrig_cxt = AllocSetContextCreate(TopTransactionContext, "DeferredTriggerXact", ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); - oldcxt = MemoryContextSwitchTo(deftrig_cxt); - deftrig_all_isset = false; /* --- 2022,2039 ---- void DeferredTriggerBeginXact(void) { if (deftrig_cxt != NULL) elog(ERROR, "DeferredTriggerBeginXact() called while inside transaction"); /* ! * Create the per transaction memory context */ ! deftrig_cxt = AllocSetContextCreate(TopTransactionContext, "DeferredTriggerXact", ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); deftrig_all_isset = false; /* *************** *** 2056,2074 **** deftrig_all_isdeferred = false; deftrig_trigstates = NIL; - foreach(l, deftrig_dfl_trigstates) - { - dflstat = (DeferredTriggerStatus) lfirst(l); - stat = (DeferredTriggerStatus) - palloc(sizeof(DeferredTriggerStatusData)); - - stat->dts_tgoid = dflstat->dts_tgoid; - stat->dts_tgisdeferred = dflstat->dts_tgisdeferred; - - deftrig_trigstates = lappend(deftrig_trigstates, stat); - } - - MemoryContextSwitchTo(oldcxt); deftrig_events = NULL; deftrig_event_tail = NULL; --- 2042,2047 ----