1 /*-------------------------------------------------------------------------
4 * definition of the system "relation" relation (pg_class)
5 * along with the relation's initial contents.
8 * Copyright (c) 1994, Regents of the University of California
10 * $Id: pg_class.h,v 1.30 1999/09/29 16:06:16 wieck Exp $
13 * ``pg_relation'' is being replaced by ``pg_class''. currently
14 * we are only changing the name in the catalogs but someday the
15 * code will be changed too. -cim 2/26/90
16 * [it finally happens. -ay 11/5/94]
18 * the genbki.sh script reads this file and generates .bki
19 * information from the DATA() statements.
21 *-------------------------------------------------------------------------
27 * postgres.h contains the system type definintions and the
28 * CATALOG(), BOOTSTRAP and DATA() sugar words so this file
29 * can be read by both genbki.sh and the C compiler.
34 * pg_class definition. cpp turns this into
35 * typedef struct FormData_pg_class
37 * Note: the #if 0, #endif around the BKI_BEGIN.. END block
38 * below keeps cpp from seeing what is meant for the
39 * genbki script: pg_relation is now called pg_class, but
40 * only in the catalogs -cim 2/26/90
45 * This structure is actually variable-length (the last attribute is
46 * a POSTGRES array). Hence, sizeof(FormData_pg_class) does not
47 * describe the fixed-length or actual size of the structure.
48 * FormData_pg_class.relacl may not be correctly aligned, either,
49 * if aclitem and struct varlena don't align together. Hence,
50 * you MUST use heap_getattr() to get the relacl field.
53 CATALOG(pg_class) BOOTSTRAP
67 * relnatts is the number of user attributes this class has. There
68 * must be exactly this many instances in Class pg_attribute for this
69 * class which have attnum > 0 (= user attribute).
71 int2 relchecks; /* # of CHECK constraints, not stored in
73 int2 reltriggers; /* # of TRIGGERs */
74 int2 relukeys; /* # of Unique keys */
75 int2 relfkeys; /* # of FOREIGN KEYs */
76 int2 relrefs; /* # of references to this relation */
77 bool relhaspkey; /* has PRIMARY KEY */
79 aclitem relacl[1]; /* this is here for the catalog */
82 #define CLASS_TUPLE_SIZE \
83 (offsetof(FormData_pg_class,relhasrules) + sizeof(bool))
86 * Form_pg_class corresponds to a pointer to a tuple with
87 * the format of pg_class relation.
90 typedef FormData_pg_class *Form_pg_class;
93 * compiler constants for pg_class
98 * Natts_pg_class_fixed is used to tell routines that insert new
99 * pg_class tuples (as opposed to replacing old ones) that there's no
103 #define Natts_pg_class_fixed 17
104 #define Natts_pg_class 18
105 #define Anum_pg_class_relname 1
106 #define Anum_pg_class_reltype 2
107 #define Anum_pg_class_relowner 3
108 #define Anum_pg_class_relam 4
109 #define Anum_pg_class_relpages 5
110 #define Anum_pg_class_reltuples 6
111 #define Anum_pg_class_relhasindex 7
112 #define Anum_pg_class_relisshared 8
113 #define Anum_pg_class_relkind 9
114 #define Anum_pg_class_relnatts 10
115 #define Anum_pg_class_relchecks 11
116 #define Anum_pg_class_reltriggers 12
117 #define Anum_pg_class_relukeys 13
118 #define Anum_pg_class_relfkeys 14
119 #define Anum_pg_class_relrefs 15
120 #define Anum_pg_class_relhaspkey 16
121 #define Anum_pg_class_relhasrules 17
122 #define Anum_pg_class_relacl 18
125 * initial contents of pg_class
129 DATA(insert OID = 1247 ( pg_type 71 PGUID 0 0 0 f f r 16 0 0 0 0 0 f f _null_ ));
131 DATA(insert OID = 1249 ( pg_attribute 75 PGUID 0 0 0 f f r 14 0 0 0 0 0 f f _null_ ));
133 DATA(insert OID = 1255 ( pg_proc 81 PGUID 0 0 0 f f r 16 0 0 0 0 0 f f _null_ ));
135 DATA(insert OID = 1259 ( pg_class 83 PGUID 0 0 0 f f r 18 0 0 0 0 0 f f _null_ ));
137 DATA(insert OID = 1260 ( pg_shadow 86 PGUID 0 0 0 f t r 8 0 0 0 0 0 f f _null_ ));
139 DATA(insert OID = 1261 ( pg_group 87 PGUID 0 0 0 f t s 3 0 0 0 0 0 f f _null_ ));
141 DATA(insert OID = 1262 ( pg_database 88 PGUID 0 0 0 f t r 4 0 0 0 0 0 f f _null_ ));
143 DATA(insert OID = 1264 ( pg_variable 90 PGUID 0 0 0 f t s 1 0 0 0 0 0 f f _null_ ));
145 DATA(insert OID = 1269 ( pg_log 99 PGUID 0 0 0 f t s 1 0 0 0 0 0 f f _null_ ));
147 DATA(insert OID = 376 ( pg_xactlock 0 PGUID 0 0 0 f t s 1 0 0 0 0 0 f f _null_ ));
149 DATA(insert OID = 1215 ( pg_attrdef 109 PGUID 0 0 0 t t r 4 0 0 0 0 0 f f _null_ ));
151 DATA(insert OID = 1216 ( pg_relcheck 110 PGUID 0 0 0 t t r 4 0 0 0 0 0 f f _null_ ));
153 DATA(insert OID = 1219 ( pg_trigger 111 PGUID 0 0 0 t t r 13 0 0 0 0 0 f f _null_ ));
156 #define RelOid_pg_type 1247
157 #define RelOid_pg_attribute 1249
158 #define RelOid_pg_proc 1255
159 #define RelOid_pg_class 1259
160 #define RelOid_pg_shadow 1260
161 #define RelOid_pg_group 1261
162 #define RelOid_pg_database 1262
163 #define RelOid_pg_variable 1264
164 #define RelOid_pg_log 1269
165 #define RelOid_pg_attrdef 1215
166 #define RelOid_pg_relcheck 1216
167 #define RelOid_pg_trigger 1219
169 /* Xact lock pseudo-table */
170 #define XactLockTableId 376
172 #define RELKIND_INDEX 'i' /* secondary index */
173 #define RELKIND_LOBJECT 'l' /* large objects */
174 #define RELKIND_RELATION 'r' /* cataloged heap */
175 #define RELKIND_SPECIAL 's' /* special (non-heap) */
176 #define RELKIND_SEQUENCE 'S' /* SEQUENCE relation */
177 #define RELKIND_UNCATALOGED 'u' /* temporary heap */
179 #endif /* PG_RELATION_H */