1 /*-------------------------------------------------------------------------
4 * definition of the system "relation" relation (pg_class)
5 * along with the relation's initial contents.
8 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
9 * Portions Copyright (c) 1994, Regents of the University of California
11 * $PostgreSQL: pgsql/src/include/catalog/pg_class.h,v 1.105 2008/03/27 03:57:34 tgl Exp $
14 * the genbki.sh script reads this file and generates .bki
15 * information from the DATA() statements.
17 *-------------------------------------------------------------------------
22 #include "catalog/genbki.h"
25 * pg_class definition. cpp turns this into
26 * typedef struct FormData_pg_class
29 #define RelationRelationId 1259
31 CATALOG(pg_class,1259) BKI_BOOTSTRAP
33 NameData relname; /* class name */
34 Oid relnamespace; /* OID of namespace containing this class */
35 Oid reltype; /* OID of associated entry in pg_type */
36 Oid relowner; /* class owner */
37 Oid relam; /* index access method; 0 if not an index */
38 Oid relfilenode; /* identifier of physical storage file */
39 Oid reltablespace; /* identifier of table space for relation */
40 int4 relpages; /* # of blocks (not always up-to-date) */
41 float4 reltuples; /* # of tuples (not always up-to-date) */
42 Oid reltoastrelid; /* OID of toast table; 0 if none */
43 Oid reltoastidxid; /* if toast table, OID of chunk_id index */
44 bool relhasindex; /* T if has (or has had) any indexes */
45 bool relisshared; /* T if shared across databases */
46 char relkind; /* see RELKIND_xxx constants below */
47 int2 relnatts; /* number of user attributes */
50 * Class pg_attribute must contain exactly "relnatts" user attributes
51 * (with attnums ranging from 1 to relnatts) for this class. It may also
52 * contain entries with negative attnums for system attributes.
54 int2 relchecks; /* # of CHECK constraints for class */
55 int2 reltriggers; /* # of TRIGGERs */
56 int2 relukeys; /* # of Unique keys (not used) */
57 int2 relfkeys; /* # of FOREIGN KEYs (not used) */
58 int2 relrefs; /* # of references to this rel (not used) */
59 bool relhasoids; /* T if we generate OIDs for rows of rel */
60 bool relhaspkey; /* has PRIMARY KEY index */
61 bool relhasrules; /* has associated rules */
62 bool relhassubclass; /* has derived classes */
63 TransactionId relfrozenxid; /* all Xids < this are frozen in this rel */
66 * VARIABLE LENGTH FIELDS start here. These fields may be NULL, too.
68 * NOTE: these fields are not present in a relcache entry's rd_rel field.
71 aclitem relacl[1]; /* access permissions */
72 text reloptions[1]; /* access-method-specific options */
75 /* Size of fixed part of pg_class tuples, not counting var-length fields */
76 #define CLASS_TUPLE_SIZE \
77 (offsetof(FormData_pg_class,relfrozenxid) + sizeof(TransactionId))
80 * Form_pg_class corresponds to a pointer to a tuple with
81 * the format of pg_class relation.
84 typedef FormData_pg_class *Form_pg_class;
87 * compiler constants for pg_class
91 #define Natts_pg_class 27
92 #define Anum_pg_class_relname 1
93 #define Anum_pg_class_relnamespace 2
94 #define Anum_pg_class_reltype 3
95 #define Anum_pg_class_relowner 4
96 #define Anum_pg_class_relam 5
97 #define Anum_pg_class_relfilenode 6
98 #define Anum_pg_class_reltablespace 7
99 #define Anum_pg_class_relpages 8
100 #define Anum_pg_class_reltuples 9
101 #define Anum_pg_class_reltoastrelid 10
102 #define Anum_pg_class_reltoastidxid 11
103 #define Anum_pg_class_relhasindex 12
104 #define Anum_pg_class_relisshared 13
105 #define Anum_pg_class_relkind 14
106 #define Anum_pg_class_relnatts 15
107 #define Anum_pg_class_relchecks 16
108 #define Anum_pg_class_reltriggers 17
109 #define Anum_pg_class_relukeys 18
110 #define Anum_pg_class_relfkeys 19
111 #define Anum_pg_class_relrefs 20
112 #define Anum_pg_class_relhasoids 21
113 #define Anum_pg_class_relhaspkey 22
114 #define Anum_pg_class_relhasrules 23
115 #define Anum_pg_class_relhassubclass 24
116 #define Anum_pg_class_relfrozenxid 25
117 #define Anum_pg_class_relacl 26
118 #define Anum_pg_class_reloptions 27
121 * initial contents of pg_class
123 * NOTE: only "bootstrapped" relations need to be declared here. Be sure that
124 * the OIDs listed here match those given in their CATALOG macros, and that
125 * the relnatts values are correct.
129 /* Note: "3" in the relfrozenxid column stands for FirstNormalTransactionId */
130 DATA(insert OID = 1247 ( pg_type PGNSP 71 PGUID 0 1247 0 0 0 0 0 f f r 26 0 0 0 0 0 t f f f 3 _null_ _null_ ));
132 DATA(insert OID = 1249 ( pg_attribute PGNSP 75 PGUID 0 1249 0 0 0 0 0 f f r 17 0 0 0 0 0 f f f f 3 _null_ _null_ ));
134 DATA(insert OID = 1255 ( pg_proc PGNSP 81 PGUID 0 1255 0 0 0 0 0 f f r 21 0 0 0 0 0 t f f f 3 _null_ _null_ ));
136 DATA(insert OID = 1259 ( pg_class PGNSP 83 PGUID 0 1259 0 0 0 0 0 f f r 27 0 0 0 0 0 t f f f 3 _null_ _null_ ));
139 #define RELKIND_INDEX 'i' /* secondary index */
140 #define RELKIND_RELATION 'r' /* ordinary cataloged heap */
141 #define RELKIND_SEQUENCE 'S' /* SEQUENCE relation */
142 #define RELKIND_UNCATALOGED 'u' /* temporary heap */
143 #define RELKIND_TOASTVALUE 't' /* moved off huge values */
144 #define RELKIND_VIEW 'v' /* view */
145 #define RELKIND_COMPOSITE_TYPE 'c' /* composite type */
147 #endif /* PG_CLASS_H */