1997-08-31 11:55:24 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* pg_trigger.h
|
1997-08-31 11:55:24 +02:00
|
|
|
*
|
|
|
|
*
|
2004-12-31 23:04:05 +01:00
|
|
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1997-08-31 11:55:24 +02:00
|
|
|
*
|
|
|
|
* NOTES
|
1997-09-07 07:04:48 +02:00
|
|
|
* the genbki.sh script reads this file and generates .bki
|
|
|
|
* information from the DATA() statements.
|
1997-08-31 11:55:24 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef PG_TRIGGER_H
|
|
|
|
#define PG_TRIGGER_H
|
|
|
|
|
|
|
|
/* ----------------
|
2003-03-10 23:28:22 +01:00
|
|
|
* postgres.h contains the system type definitions and the
|
2005-04-14 03:38:22 +02:00
|
|
|
* CATALOG(), BKI_BOOTSTRAP and DATA() sugar words so this file
|
1997-09-07 07:04:48 +02:00
|
|
|
* can be read by both genbki.sh and the C compiler.
|
1997-08-31 11:55:24 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* pg_trigger definition. cpp turns this into
|
|
|
|
* typedef struct FormData_pg_trigger
|
1997-08-31 11:55:24 +02:00
|
|
|
* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
*/
|
2005-04-14 03:38:22 +02:00
|
|
|
#define TriggerRelationId 2620
|
|
|
|
|
|
|
|
CATALOG(pg_trigger,2620)
|
1997-09-07 07:04:48 +02:00
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Oid tgrelid; /* triggered relation */
|
|
|
|
NameData tgname; /* trigger' name */
|
|
|
|
Oid tgfoid; /* OID of function to be called */
|
|
|
|
int2 tgtype; /* BEFORE/AFTER UPDATE/DELETE/INSERT
|
1997-09-07 07:04:48 +02:00
|
|
|
* ROW/STATEMENT */
|
1999-09-29 18:06:40 +02:00
|
|
|
bool tgenabled; /* trigger is enabled/disabled */
|
2000-04-12 19:17:23 +02:00
|
|
|
bool tgisconstraint; /* trigger is a RI constraint */
|
1999-09-29 18:06:40 +02:00
|
|
|
NameData tgconstrname; /* RI constraint name */
|
|
|
|
Oid tgconstrrelid; /* RI table of foreign key definition */
|
|
|
|
bool tgdeferrable; /* RI trigger is deferrable */
|
2000-04-12 19:17:23 +02:00
|
|
|
bool tginitdeferred; /* RI trigger is deferred initially */
|
1997-09-08 04:41:22 +02:00
|
|
|
int2 tgnargs; /* # of extra arguments in tgargs */
|
2005-03-29 02:17:27 +02:00
|
|
|
|
|
|
|
/* VARIABLE LENGTH FIELDS: */
|
|
|
|
int2vector tgattr; /* reserved for column-specific triggers */
|
1997-09-08 04:41:22 +02:00
|
|
|
bytea tgargs; /* first\000second\000tgnargs\000 */
|
1997-08-31 11:55:24 +02:00
|
|
|
} FormData_pg_trigger;
|
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Form_pg_trigger corresponds to a pointer to a tuple with
|
|
|
|
* the format of pg_trigger relation.
|
1997-08-31 11:55:24 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef FormData_pg_trigger *Form_pg_trigger;
|
1997-08-31 11:55:24 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* compiler constants for pg_trigger
|
1997-08-31 11:55:24 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1999-09-29 18:06:40 +02:00
|
|
|
#define Natts_pg_trigger 13
|
1997-09-07 07:04:48 +02:00
|
|
|
#define Anum_pg_trigger_tgrelid 1
|
|
|
|
#define Anum_pg_trigger_tgname 2
|
|
|
|
#define Anum_pg_trigger_tgfoid 3
|
|
|
|
#define Anum_pg_trigger_tgtype 4
|
1999-09-29 18:06:40 +02:00
|
|
|
#define Anum_pg_trigger_tgenabled 5
|
|
|
|
#define Anum_pg_trigger_tgisconstraint 6
|
|
|
|
#define Anum_pg_trigger_tgconstrname 7
|
|
|
|
#define Anum_pg_trigger_tgconstrrelid 8
|
|
|
|
#define Anum_pg_trigger_tgdeferrable 9
|
|
|
|
#define Anum_pg_trigger_tginitdeferred 10
|
|
|
|
#define Anum_pg_trigger_tgnargs 11
|
|
|
|
#define Anum_pg_trigger_tgattr 12
|
|
|
|
#define Anum_pg_trigger_tgargs 13
|
1997-08-31 11:55:24 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define TRIGGER_TYPE_ROW (1 << 0)
|
|
|
|
#define TRIGGER_TYPE_BEFORE (1 << 1)
|
|
|
|
#define TRIGGER_TYPE_INSERT (1 << 2)
|
|
|
|
#define TRIGGER_TYPE_DELETE (1 << 3)
|
|
|
|
#define TRIGGER_TYPE_UPDATE (1 << 4)
|
1997-08-31 11:55:24 +02:00
|
|
|
|
2005-05-25 23:40:43 +02:00
|
|
|
#define TRIGGER_CLEAR_TYPE(type) ((type) = 0)
|
1997-08-31 11:55:24 +02:00
|
|
|
|
2005-05-25 23:40:43 +02:00
|
|
|
#define TRIGGER_SETT_ROW(type) ((type) |= TRIGGER_TYPE_ROW)
|
|
|
|
#define TRIGGER_SETT_BEFORE(type) ((type) |= TRIGGER_TYPE_BEFORE)
|
|
|
|
#define TRIGGER_SETT_INSERT(type) ((type) |= TRIGGER_TYPE_INSERT)
|
|
|
|
#define TRIGGER_SETT_DELETE(type) ((type) |= TRIGGER_TYPE_DELETE)
|
|
|
|
#define TRIGGER_SETT_UPDATE(type) ((type) |= TRIGGER_TYPE_UPDATE)
|
1997-08-31 11:55:24 +02:00
|
|
|
|
2005-05-25 23:40:43 +02:00
|
|
|
#define TRIGGER_FOR_ROW(type) ((type) & TRIGGER_TYPE_ROW)
|
|
|
|
#define TRIGGER_FOR_BEFORE(type) ((type) & TRIGGER_TYPE_BEFORE)
|
|
|
|
#define TRIGGER_FOR_INSERT(type) ((type) & TRIGGER_TYPE_INSERT)
|
|
|
|
#define TRIGGER_FOR_DELETE(type) ((type) & TRIGGER_TYPE_DELETE)
|
|
|
|
#define TRIGGER_FOR_UPDATE(type) ((type) & TRIGGER_TYPE_UPDATE)
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* PG_TRIGGER_H */
|