aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2002-11-23 03:59:09 +0000
committerBruce Momjian <bruce@momjian.us>2002-11-23 03:59:09 +0000
commit1b7f3cc02d6129b678ab651716c19d2bf8f7f6ab (patch)
treec9929a24cffcdf4989ca67f3ef42056fe2c2f52e /src/include
parentea29b32758bdd293a9b932195db662209bb0ee52 (diff)
downloadpostgresql-1b7f3cc02d6129b678ab651716c19d2bf8f7f6ab.tar.gz
postgresql-1b7f3cc02d6129b678ab651716c19d2bf8f7f6ab.zip
This patch implements FOR EACH STATEMENT triggers, per my email to
-hackers a couple days ago. Notes/caveats: - added regression tests for the new functionality, all regression tests pass on my machine - added pg_dump support - updated PL/PgSQL to support per-statement triggers; didn't look at the other procedural languages. - there's (even) more code duplication in trigger.c than there was previously. Any suggestions on how to refactor the ExecXXXTriggers() functions to reuse more code would be welcome -- I took a brief look at it, but couldn't see an easy way to do it (there are several subtly-different versions of the code in question) - updated the documentation. I also took the liberty of removing a big chunk of duplicated syntax documentation in the Programmer's Guide on triggers, and moving that information to the CREATE TRIGGER reference page. - I also included some spelling fixes and similar small cleanups I noticed while making the changes. If you'd like me to split those into a separate patch, let me know. Neil Conway
Diffstat (limited to 'src/include')
-rw-r--r--src/include/commands/trigger.h14
-rw-r--r--src/include/nodes/parsenodes.h8
-rw-r--r--src/include/utils/pg_lzcompress.h8
-rw-r--r--src/include/utils/rel.h4
4 files changed, 21 insertions, 13 deletions
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h
index 219b2251f5e..497a3622bf7 100644
--- a/src/include/commands/trigger.h
+++ b/src/include/commands/trigger.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: trigger.h,v 1.39 2002/10/14 16:51:30 tgl Exp $
+ * $Id: trigger.h,v 1.40 2002/11/23 03:59:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -116,18 +116,30 @@ extern TriggerDesc *CopyTriggerDesc(TriggerDesc *trigdesc);
extern void FreeTriggerDesc(TriggerDesc *trigdesc);
+extern void ExecBSInsertTriggers(EState *estate,
+ ResultRelInfo *relinfo);
+extern void ExecASInsertTriggers(EState *estate,
+ ResultRelInfo *relinfo);
extern HeapTuple ExecBRInsertTriggers(EState *estate,
ResultRelInfo *relinfo,
HeapTuple trigtuple);
extern void ExecARInsertTriggers(EState *estate,
ResultRelInfo *relinfo,
HeapTuple trigtuple);
+extern void ExecBSDeleteTriggers(EState *estate,
+ ResultRelInfo *relinfo);
+extern void ExecASDeleteTriggers(EState *estate,
+ ResultRelInfo *relinfo);
extern bool ExecBRDeleteTriggers(EState *estate,
ResultRelInfo *relinfo,
ItemPointer tupleid);
extern void ExecARDeleteTriggers(EState *estate,
ResultRelInfo *relinfo,
ItemPointer tupleid);
+extern void ExecBSUpdateTriggers(EState *estate,
+ ResultRelInfo *relinfo);
+extern void ExecASUpdateTriggers(EState *estate,
+ ResultRelInfo *relinfo);
extern HeapTuple ExecBRUpdateTriggers(EState *estate,
ResultRelInfo *relinfo,
ItemPointer tupleid,
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 92501196f93..0d33b56d1fe 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parsenodes.h,v 1.216 2002/11/19 23:21:59 tgl Exp $
+ * $Id: parsenodes.h,v 1.217 2002/11/23 03:59:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1048,11 +1048,7 @@ typedef struct CreateTrigStmt
List *args; /* list of (T_String) Values or NIL */
bool before; /* BEFORE/AFTER */
bool row; /* ROW/STATEMENT */
- char actions[4]; /* Insert, Update, Delete */
- char *lang; /* currently not used, always NULL */
- char *text; /* AS 'text' */
- List *attr; /* UPDATE OF a, b,... (NI) or NULL */
- char *when; /* WHEN 'a > 10 ...' (NI) or NULL */
+ char actions[3]; /* Insert, Update, Delete */
/* The following are used for referential */
/* integrity constraint triggers */
diff --git a/src/include/utils/pg_lzcompress.h b/src/include/utils/pg_lzcompress.h
index 862790cfb78..24e4fae4a4f 100644
--- a/src/include/utils/pg_lzcompress.h
+++ b/src/include/utils/pg_lzcompress.h
@@ -1,7 +1,7 @@
/* ----------
* pg_lzcompress.h -
*
- * $Header: /cvsroot/pgsql/src/include/utils/pg_lzcompress.h,v 1.8 2001/11/05 17:46:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/include/utils/pg_lzcompress.h,v 1.9 2002/11/23 03:59:09 momjian Exp $
*
* Definitions for the builtin LZ compressor
* ----------
@@ -89,7 +89,7 @@ typedef struct PGLZ_Header
* match_size_good The initial GOOD match size when starting history
* lookup. When looking up the history to find a
* match that could be expressed as a tag, the
- * algorithm does not allways walk back entirely.
+ * algorithm does not always walk back entirely.
* A good match fast is usually better than the
* best possible one very late. For each iteration
* in the lookup, this value is lowered so the
@@ -147,7 +147,7 @@ typedef struct PGLZ_DecompState
* This is the default strategy if none
* is given to pglz_compress().
*
- * PGLZ_strategy_allways Starts compression on any infinitely
+ * PGLZ_strategy_always Starts compression on any infinitely
* small input and does fallback to
* uncompressed storage only if output
* would be larger than input.
@@ -158,7 +158,7 @@ typedef struct PGLZ_DecompState
* ----------
*/
extern PGLZ_Strategy *PGLZ_strategy_default;
-extern PGLZ_Strategy *PGLZ_strategy_allways;
+extern PGLZ_Strategy *PGLZ_strategy_always;
extern PGLZ_Strategy *PGLZ_strategy_never;
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index ed06e1861a2..a9ff7325c1e 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: rel.h,v 1.63 2002/09/04 20:31:46 momjian Exp $
+ * $Id: rel.h,v 1.64 2002/11/23 03:59:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -71,7 +71,7 @@ typedef struct TriggerDesc
* trigger can appear in more than one class, for each class we
* provide a list of integer indexes into the triggers array.
*/
-#define TRIGGER_NUM_EVENT_CLASSES 4
+#define TRIGGER_NUM_EVENT_CLASSES 3
uint16 n_before_statement[TRIGGER_NUM_EVENT_CLASSES];
uint16 n_before_row[TRIGGER_NUM_EVENT_CLASSES];