Welcome, triggers
This commit is contained in:
parent
6a061da272
commit
2d7b93c0ca
@ -7,7 +7,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: indexing.h,v 1.3 1997/08/21 01:37:48 vadim Exp $
|
||||
* $Id: indexing.h,v 1.4 1997/08/31 09:55:20 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -26,6 +26,7 @@
|
||||
#define Num_pg_class_indices 2
|
||||
#define Num_pg_attrdef_indices 1
|
||||
#define Num_pg_relcheck_indices 1
|
||||
#define Num_pg_trigger_indices 1
|
||||
|
||||
|
||||
/*
|
||||
@ -43,6 +44,7 @@
|
||||
#define ClassOidIndex "pg_classoidind"
|
||||
#define AttrDefaultIndex "pg_attrdefind"
|
||||
#define RelCheckIndex "pg_relcheckind"
|
||||
#define TriggerRelidIndex "pg_trigrelidind"
|
||||
|
||||
extern char *Name_pg_attr_indices[];
|
||||
extern char *Name_pg_proc_indices[];
|
||||
@ -50,6 +52,7 @@ extern char *Name_pg_type_indices[];
|
||||
extern char *Name_pg_class_indices[];
|
||||
extern char *Name_pg_attrdef_indices[];
|
||||
extern char *Name_pg_relcheck_indices[];
|
||||
extern char *Name_pg_trigger_indices[];
|
||||
|
||||
extern char *IndexedCatalogNames[];
|
||||
|
||||
@ -107,6 +110,8 @@ DECLARE_INDEX(pg_classoidind on pg_class using btree (Oid oid_ops));
|
||||
DECLARE_INDEX(pg_attrdefind on pg_attrdef using btree (adrelid oid_ops));
|
||||
DECLARE_INDEX(pg_relcheckind on pg_relcheck using btree (rcrelid oid_ops));
|
||||
|
||||
DECLARE_INDEX(pg_trigrelidind on pg_trigger using btree (tgrelid oid_ops));
|
||||
|
||||
/* now build indices in the initialization scripts */
|
||||
BUILD_INDICES
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pg_attribute.h,v 1.12 1997/08/22 04:04:18 vadim Exp $
|
||||
* $Id: pg_attribute.h,v 1.13 1997/08/31 09:55:21 vadim Exp $
|
||||
*
|
||||
* NOTES
|
||||
* the genbki.sh script reads this file and generates .bki
|
||||
@ -417,9 +417,10 @@ DATA(insert OID = 0 ( 1249 vtype 18 0 1 -11 0 -1 t f c f f));
|
||||
{ 1259l, {"relarch"}, 18, 0l, 1, 11, 0l, -1l, '\001', '\0', 'c', '\0', '\0' }, \
|
||||
{ 1259l, {"relnatts"}, 21, 0l, 2, 12, 0l, -1l, '\001', '\0', 's', '\0', '\0' }, \
|
||||
{ 1259l, {"relsmgr"}, 210l, 0l, 2, 13, 0l, -1l, '\001', '\0', 's', '\0', '\0' }, \
|
||||
{ 1259l, {"relchecks"}, 21l, 0l, 2, 14, 0l, -1l, '\001', '\0', 's', '\0', '\0' }, \
|
||||
{ 1259l, {"relhasrules"}, 16, 0l, 1, 15, 0l, -1l, '\001', '\0', 'c', '\0', '\0' }, \
|
||||
{ 1259l, {"relacl"}, 1034l, 0l, -1, 16, 0l, -1l, '\0', '\0', 'i', '\0', '\0' }
|
||||
{ 1259l, {"relchecks"}, 21l, 0l, 2, 14, 0l, -1l, '\001', '\0', 's', '\0', '\0' }, \
|
||||
{ 1259l, {"reltriggers"}, 21l, 0l, 2, 15, 0l, -1l, '\001', '\0', 's', '\0', '\0' }, \
|
||||
{ 1259l, {"relhasrules"}, 16, 0l, 1, 16, 0l, -1l, '\001', '\0', 'c', '\0', '\0' }, \
|
||||
{ 1259l, {"relacl"}, 1034l, 0l, -1, 17, 0l, -1l, '\0', '\0', 'i', '\0', '\0' }
|
||||
|
||||
DATA(insert OID = 0 ( 1259 relname 19 0 NAMEDATALEN 1 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1259 reltype 26 0 4 2 0 -1 t f i f f));
|
||||
@ -436,8 +437,9 @@ DATA(insert OID = 0 ( 1259 relarch 18 0 1 11 0 -1 t f c f f));
|
||||
DATA(insert OID = 0 ( 1259 relnatts 21 0 2 12 0 -1 t f s f f));
|
||||
DATA(insert OID = 0 ( 1259 relsmgr 210 0 2 13 0 -1 t f s f f));
|
||||
DATA(insert OID = 0 ( 1259 relchecks 21 0 2 14 0 -1 t f s f f));
|
||||
DATA(insert OID = 0 ( 1259 relhasrules 16 0 1 15 0 -1 t f c f f));
|
||||
DATA(insert OID = 0 ( 1259 relacl 1034 0 -1 16 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1259 reltriggers 21 0 2 15 0 -1 t f s f f));
|
||||
DATA(insert OID = 0 ( 1259 relhasrules 16 0 1 16 0 -1 t f c f f));
|
||||
DATA(insert OID = 0 ( 1259 relacl 1034 0 -1 17 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1259 ctid 27 0 6 -1 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1259 oid 26 0 4 -2 0 -1 t f i f f));
|
||||
DATA(insert OID = 0 ( 1259 xmin 28 0 4 -3 0 -1 f f i f f));
|
||||
@ -526,6 +528,32 @@ DATA(insert OID = 0 ( 1216 tmin 702 0 4 -9 0 -1 t f i f f));
|
||||
DATA(insert OID = 0 ( 1216 tmax 702 0 4 -10 0 -1 t f i f f));
|
||||
DATA(insert OID = 0 ( 1216 vtype 18 0 1 -11 0 -1 t f c f f));
|
||||
|
||||
/* ----------------
|
||||
* pg_trigger
|
||||
* ----------------
|
||||
*/
|
||||
DATA(insert OID = 0 ( 1219 tgrelid 26 0 4 1 0 -1 t f i f f));
|
||||
DATA(insert OID = 0 ( 1219 tgname 19 0 NAMEDATALEN 2 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1219 tgfunc 19 0 NAMEDATALEN 3 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1219 tglang 26 0 4 4 0 -1 t f i f f));
|
||||
DATA(insert OID = 0 ( 1219 tgtype 21 0 2 5 0 -1 t f s f f));
|
||||
DATA(insert OID = 0 ( 1219 tgnargs 21 0 2 6 0 -1 t f s f f));
|
||||
DATA(insert OID = 0 ( 1219 tgattr 22 0 16 7 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1219 tgtext 17 0 -1 8 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1219 tgargs 17 0 -1 9 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1219 tgwhen 25 0 -1 10 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1219 ctid 27 0 6 -1 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1219 oid 26 0 4 -2 0 -1 t f i f f));
|
||||
DATA(insert OID = 0 ( 1219 xmin 28 0 4 -3 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1219 cmin 29 0 2 -4 0 -1 t f s f f));
|
||||
DATA(insert OID = 0 ( 1219 xmax 28 0 4 -5 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1219 cmax 29 0 2 -6 0 -1 t f s f f));
|
||||
DATA(insert OID = 0 ( 1219 chain 27 0 6 -7 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1219 anchor 27 0 6 -8 0 -1 f f i f f));
|
||||
DATA(insert OID = 0 ( 1219 tmin 702 0 4 -9 0 -1 t f i f f));
|
||||
DATA(insert OID = 0 ( 1219 tmax 702 0 4 -10 0 -1 t f i f f));
|
||||
DATA(insert OID = 0 ( 1219 vtype 18 0 1 -11 0 -1 t f c f f));
|
||||
|
||||
/* ----------------
|
||||
* pg_hosts - this relation is used to store host based authentication
|
||||
* info
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pg_class.h,v 1.7 1997/08/22 04:04:19 vadim Exp $
|
||||
* $Id: pg_class.h,v 1.8 1997/08/31 09:55:22 vadim Exp $
|
||||
*
|
||||
* NOTES
|
||||
* ``pg_relation'' is being replaced by ``pg_class''. currently
|
||||
@ -70,6 +70,7 @@ CATALOG(pg_class) BOOTSTRAP {
|
||||
*/
|
||||
int2 relsmgr;
|
||||
int2 relchecks; /* # of CHECK constraints */
|
||||
int2 reltriggers; /* # of TRIGGERs */
|
||||
bool relhasrules;
|
||||
aclitem relacl[1]; /* this is here for the catalog */
|
||||
} FormData_pg_class;
|
||||
@ -95,8 +96,8 @@ typedef FormData_pg_class *Form_pg_class;
|
||||
* relacl field.
|
||||
* ----------------
|
||||
*/
|
||||
#define Natts_pg_class_fixed 16
|
||||
#define Natts_pg_class 17
|
||||
#define Natts_pg_class_fixed 17
|
||||
#define Natts_pg_class 18
|
||||
#define Anum_pg_class_relname 1
|
||||
#define Anum_pg_class_reltype 2
|
||||
#define Anum_pg_class_relowner 3
|
||||
@ -112,31 +113,33 @@ typedef FormData_pg_class *Form_pg_class;
|
||||
#define Anum_pg_class_relnatts 13
|
||||
#define Anum_pg_class_relsmgr 14
|
||||
#define Anum_pg_class_relchecks 15
|
||||
#define Anum_pg_class_relhasrules 16
|
||||
#define Anum_pg_class_relacl 17
|
||||
#define Anum_pg_class_reltriggers 16
|
||||
#define Anum_pg_class_relhasrules 17
|
||||
#define Anum_pg_class_relacl 18
|
||||
|
||||
/* ----------------
|
||||
* initial contents of pg_class
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
DATA(insert OID = 1247 ( pg_type 71 PGUID 0 0 0 0 0 f f r n 16 0 0 f _null_ ));
|
||||
DATA(insert OID = 1249 ( pg_attribute 75 PGUID 0 0 0 0 0 f f r n 16 0 0 f _null_ ));
|
||||
DATA(insert OID = 1251 ( pg_demon 76 PGUID 0 0 0 0 0 f t r n 4 0 0 f _null_ ));
|
||||
DATA(insert OID = 1253 ( pg_magic 80 PGUID 0 0 0 0 0 f t r n 2 0 0 f _null_ ));
|
||||
DATA(insert OID = 1255 ( pg_proc 81 PGUID 0 0 0 0 0 f f r n 16 0 0 f _null_ ));
|
||||
DATA(insert OID = 1257 ( pg_server 82 PGUID 0 0 0 0 0 f t r n 3 0 0 f _null_ ));
|
||||
DATA(insert OID = 1259 ( pg_class 83 PGUID 0 0 0 0 0 f f r n 18 0 0 f _null_ ));
|
||||
DATA(insert OID = 1260 ( pg_user 86 PGUID 0 0 0 0 0 f t r n 6 0 0 f _null_ ));
|
||||
DATA(insert OID = 1261 ( pg_group 87 PGUID 0 0 0 0 0 f t s n 3 0 0 f _null_ ));
|
||||
DATA(insert OID = 1262 ( pg_database 88 PGUID 0 0 0 0 0 f t r n 3 0 0 f _null_ ));
|
||||
DATA(insert OID = 1263 ( pg_defaults 89 PGUID 0 0 0 0 0 f t r n 2 0 0 f _null_ ));
|
||||
DATA(insert OID = 1264 ( pg_variable 90 PGUID 0 0 0 0 0 f t s n 2 0 0 f _null_ ));
|
||||
DATA(insert OID = 1269 ( pg_log 99 PGUID 0 0 0 0 0 f t s n 1 0 0 f _null_ ));
|
||||
DATA(insert OID = 1271 ( pg_time 100 PGUID 0 0 0 0 0 f t s n 1 0 0 f _null_ ));
|
||||
DATA(insert OID = 1273 ( pg_hosts 101 PGUID 0 0 0 0 0 f t s n 3 0 0 f _null_ ));
|
||||
DATA(insert OID = 1215 ( pg_attrdef 109 PGUID 0 0 0 0 0 t t r n 4 0 0 f _null_ ));
|
||||
DATA(insert OID = 1216 ( pg_relcheck 110 PGUID 0 0 0 0 0 t t r n 4 0 0 f _null_ ));
|
||||
DATA(insert OID = 1247 ( pg_type 71 PGUID 0 0 0 0 0 f f r n 16 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1249 ( pg_attribute 75 PGUID 0 0 0 0 0 f f r n 16 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1251 ( pg_demon 76 PGUID 0 0 0 0 0 f t r n 4 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1253 ( pg_magic 80 PGUID 0 0 0 0 0 f t r n 2 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1255 ( pg_proc 81 PGUID 0 0 0 0 0 f f r n 16 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1257 ( pg_server 82 PGUID 0 0 0 0 0 f t r n 3 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1259 ( pg_class 83 PGUID 0 0 0 0 0 f f r n 18 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1260 ( pg_user 86 PGUID 0 0 0 0 0 f t r n 6 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1261 ( pg_group 87 PGUID 0 0 0 0 0 f t s n 3 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1262 ( pg_database 88 PGUID 0 0 0 0 0 f t r n 3 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1263 ( pg_defaults 89 PGUID 0 0 0 0 0 f t r n 2 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1264 ( pg_variable 90 PGUID 0 0 0 0 0 f t s n 2 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1269 ( pg_log 99 PGUID 0 0 0 0 0 f t s n 1 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1271 ( pg_time 100 PGUID 0 0 0 0 0 f t s n 1 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1273 ( pg_hosts 101 PGUID 0 0 0 0 0 f t s n 3 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1215 ( pg_attrdef 109 PGUID 0 0 0 0 0 t t r n 4 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1216 ( pg_relcheck 110 PGUID 0 0 0 0 0 t t r n 4 0 0 0 f _null_ ));
|
||||
DATA(insert OID = 1219 ( pg_trigger 111 PGUID 0 0 0 0 0 t t r n 10 0 0 0 f _null_ ));
|
||||
|
||||
#define RelOid_pg_type 1247
|
||||
#define RelOid_pg_demon 1251
|
||||
@ -155,6 +158,7 @@ DATA(insert OID = 1216 ( pg_relcheck 110 PGUID 0 0 0 0 0 t t r n 4 0 0 f _n
|
||||
#define RelOid_pg_hosts 1273
|
||||
#define RelOid_pg_attrdef 1215
|
||||
#define RelOid_pg_relcheck 1216
|
||||
#define RelOid_pg_trigger 1219
|
||||
|
||||
#define MAX_SYSTEM_RELOID 1273 /* this does not seem to be used */
|
||||
/* anywhere */
|
||||
|
85
src/include/catalog/pg_trigger.h
Normal file
85
src/include/catalog/pg_trigger.h
Normal file
@ -0,0 +1,85 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* pg_trigger.h--
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* NOTES
|
||||
* the genbki.sh script reads this file and generates .bki
|
||||
* information from the DATA() statements.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PG_TRIGGER_H
|
||||
#define PG_TRIGGER_H
|
||||
|
||||
/* ----------------
|
||||
* postgres.h contains the system type definintions and the
|
||||
* CATALOG(), BOOTSTRAP and DATA() sugar words so this file
|
||||
* can be read by both genbki.sh and the C compiler.
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
/* ----------------
|
||||
* pg_trigger definition. cpp turns this into
|
||||
* typedef struct FormData_pg_trigger
|
||||
* ----------------
|
||||
*/
|
||||
CATALOG(pg_trigger) BOOTSTRAP {
|
||||
Oid tgrelid; /* triggered relation */
|
||||
NameData tgname; /* trigger' name */
|
||||
NameData tgfunc; /* name of function to be called */
|
||||
Oid tglang; /* Language. Only ClanguageId currently */
|
||||
int2 tgtype; /* BEFORE/AFTER UPDATE/DELETE/INSERT ROW/STATEMENT */
|
||||
int2 tgnargs; /* # of extra arguments in tgargs */
|
||||
int28 tgattr; /* UPDATE of attr1, attr2 ... (NI) */
|
||||
bytea tgtext; /* currently, where to find .so */
|
||||
bytea tgargs; /* first\000second\000tgnargs\000 */
|
||||
text tgwhen; /* when (a > 10 or b = 3) fire trigger (NI) */
|
||||
} FormData_pg_trigger;
|
||||
|
||||
/* ----------------
|
||||
* Form_pg_trigger corresponds to a pointer to a tuple with
|
||||
* the format of pg_trigger relation.
|
||||
* ----------------
|
||||
*/
|
||||
typedef FormData_pg_trigger *Form_pg_trigger;
|
||||
|
||||
/* ----------------
|
||||
* compiler constants for pg_trigger
|
||||
* ----------------
|
||||
*/
|
||||
#define Natts_pg_trigger 10
|
||||
#define Anum_pg_trigger_tgrelid 1
|
||||
#define Anum_pg_trigger_tgname 2
|
||||
#define Anum_pg_trigger_tgfunc 3
|
||||
#define Anum_pg_trigger_tglang 4
|
||||
#define Anum_pg_trigger_tgtype 5
|
||||
#define Anum_pg_trigger_tgnargs 6
|
||||
#define Anum_pg_trigger_tgattr 7
|
||||
#define Anum_pg_trigger_tgtext 8
|
||||
#define Anum_pg_trigger_tgargs 9
|
||||
#define Anum_pg_trigger_tgwhen 10
|
||||
|
||||
#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)
|
||||
|
||||
#define TRIGGER_CLEAR_TYPE(type) (type = 0)
|
||||
|
||||
#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)
|
||||
|
||||
#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)
|
||||
|
||||
#endif /* PG_TRIGGER_H */
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pg_type.h,v 1.15 1997/08/22 00:02:19 momjian Exp $
|
||||
* $Id: pg_type.h,v 1.16 1997/08/31 09:55:24 vadim Exp $
|
||||
*
|
||||
* NOTES
|
||||
* the genbki.sh script reads this file and generates .bki
|
||||
@ -202,6 +202,7 @@ DATA(insert OID = 100 ( pg_time PGUID 1 1 t b t \054 1271 0 foo bar foo bar
|
||||
DATA(insert OID = 101 ( pg_hosts PGUID 1 1 t b t \054 1273 0 foo bar foo bar c _null_));
|
||||
DATA(insert OID = 109 ( pg_attrdef PGUID 1 1 t b t \054 1215 0 foo bar foo bar c _null_));
|
||||
DATA(insert OID = 110 ( pg_relcheck PGUID 1 1 t b t \054 1216 0 foo bar foo bar c _null_));
|
||||
DATA(insert OID = 111 ( pg_trigger PGUID 1 1 t b t \054 1219 0 foo bar foo bar c _null_));
|
||||
|
||||
/* OIDS 200 - 299 */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user