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