diff options
| author | Tom Lane | 2004-09-10 18:40:09 +0000 |
|---|---|---|
| committer | Tom Lane | 2004-09-10 18:40:09 +0000 |
| commit | b339d1fff6c2f14776af29a35c8550b222ca70b2 (patch) | |
| tree | be0ed19fa78e35cdde627d1c6bc4c4be9f7cb44e /src/include/commands/trigger.h | |
| parent | 856d1faac1024717b7c37665c46fd635dc52b1b4 (diff) | |
Fire non-deferred AFTER triggers immediately upon query completion,
rather than when returning to the idle loop. This makes no particular
difference for interactively-issued queries, but it makes a big difference
for queries issued within functions: trigger execution now occurs before
the calling function is allowed to proceed. This responds to numerous
complaints about nonintuitive behavior of foreign key checking, such as
http://archives.postgresql.org/pgsql-bugs/2004-09/msg00020.php, and
appears to be required by the SQL99 spec.
Also take the opportunity to simplify the data structures used for the
pending-trigger list, rename them for more clarity, and squeeze out a
bit of space.
Diffstat (limited to 'src/include/commands/trigger.h')
| -rw-r--r-- | src/include/commands/trigger.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h index f23889668c1..7d5569018ae 100644 --- a/src/include/commands/trigger.h +++ b/src/include/commands/trigger.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.48 2004/08/29 05:06:56 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/trigger.h,v 1.49 2004/09/10 18:40:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -45,11 +45,12 @@ typedef struct TriggerData #define TRIGGER_EVENT_ROW 0x00000004 #define TRIGGER_EVENT_BEFORE 0x00000008 -#define TRIGGER_DEFERRED_DONE 0x00000010 -#define TRIGGER_DEFERRED_CANCELED 0x00000020 -#define TRIGGER_DEFERRED_DEFERRABLE 0x00000040 -#define TRIGGER_DEFERRED_INITDEFERRED 0x00000080 -#define TRIGGER_DEFERRED_HAS_BEFORE 0x00000100 +/* More TriggerEvent flags, used only within trigger.c */ + +#define AFTER_TRIGGER_DONE 0x00000010 +#define AFTER_TRIGGER_IN_PROGRESS 0x00000020 +#define AFTER_TRIGGER_DEFERRABLE 0x00000040 +#define AFTER_TRIGGER_INITDEFERRED 0x00000080 #define TRIGGER_FIRED_BY_INSERT(event) \ (((TriggerEvent) (event) & TRIGGER_EVENT_OPMASK) == \ @@ -151,14 +152,15 @@ extern void ExecARUpdateTriggers(EState *estate, ItemPointer tupleid, HeapTuple newtuple); -extern void DeferredTriggerBeginXact(void); -extern void DeferredTriggerEndQuery(void); -extern void DeferredTriggerEndXact(void); -extern void DeferredTriggerAbortXact(void); -extern void DeferredTriggerBeginSubXact(void); -extern void DeferredTriggerEndSubXact(bool isCommit); +extern void AfterTriggerBeginXact(void); +extern void AfterTriggerBeginQuery(void); +extern void AfterTriggerEndQuery(void); +extern void AfterTriggerEndXact(void); +extern void AfterTriggerAbortXact(void); +extern void AfterTriggerBeginSubXact(void); +extern void AfterTriggerEndSubXact(bool isCommit); -extern void DeferredTriggerSetState(ConstraintsSetStmt *stmt); +extern void AfterTriggerSetState(ConstraintsSetStmt *stmt); /* |
