1 /*-------------------------------------------------------------------------
4 * definition of the system "relation" relation (pg_class)
5 * along with the relation's initial contents.
8 * Portions Copyright (c) 1996-2010, 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.118 2010/01/02 16:58:01 momjian 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
30 #define RelationRelation_Rowtype_Id 83
32 CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83)
34 NameData relname; /* class name */
35 Oid relnamespace; /* OID of namespace containing this class */
36 Oid reltype; /* OID of associated entry in pg_type */
37 Oid relowner; /* class owner */
38 Oid relam; /* index access method; 0 if not an index */
39 Oid relfilenode; /* identifier of physical storage file */
40 Oid reltablespace; /* identifier of table space for relation */
41 int4 relpages; /* # of blocks (not always up-to-date) */
42 float4 reltuples; /* # of tuples (not always up-to-date) */
43 Oid reltoastrelid; /* OID of toast table; 0 if none */
44 Oid reltoastidxid; /* if toast table, OID of chunk_id index */
45 bool relhasindex; /* T if has (or has had) any indexes */
46 bool relisshared; /* T if shared across databases */
47 bool relistemp; /* T if temporary relation */
48 char relkind; /* see RELKIND_xxx constants below */
49 int2 relnatts; /* number of user attributes */
52 * Class pg_attribute must contain exactly "relnatts" user attributes
53 * (with attnums ranging from 1 to relnatts) for this class. It may also
54 * contain entries with negative attnums for system attributes.
56 int2 relchecks; /* # of CHECK constraints for class */
57 bool relhasoids; /* T if we generate OIDs for rows of rel */
58 bool relhaspkey; /* has (or has had) PRIMARY KEY index */
59 bool relhasexclusion; /* has (or has had) exclusion constraint */
60 bool relhasrules; /* has (or has had) any rules */
61 bool relhastriggers; /* has (or has had) any TRIGGERs */
62 bool relhassubclass; /* has (or has had) 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 26
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_relistemp 14
106 #define Anum_pg_class_relkind 15
107 #define Anum_pg_class_relnatts 16
108 #define Anum_pg_class_relchecks 17
109 #define Anum_pg_class_relhasoids 18
110 #define Anum_pg_class_relhaspkey 19
111 #define Anum_pg_class_relhasexclusion 20
112 #define Anum_pg_class_relhasrules 21
113 #define Anum_pg_class_relhastriggers 22
114 #define Anum_pg_class_relhassubclass 23
115 #define Anum_pg_class_relfrozenxid 24
116 #define Anum_pg_class_relacl 25
117 #define Anum_pg_class_reloptions 26
120 * initial contents of pg_class
122 * NOTE: only "bootstrapped" relations need to be declared here. Be sure that
123 * the OIDs listed here match those given in their CATALOG macros, and that
124 * the relnatts values are correct.
128 /* Note: "3" in the relfrozenxid column stands for FirstNormalTransactionId */
129 DATA(insert OID = 1247 ( pg_type PGNSP 71 PGUID 0 1247 0 0 0 0 0 f f f r 28 0 t f f f f f 3 _null_ _null_ ));
131 DATA(insert OID = 1249 ( pg_attribute PGNSP 75 PGUID 0 1249 0 0 0 0 0 f f f r 19 0 f f f f f f 3 _null_ _null_ ));
133 DATA(insert OID = 1255 ( pg_proc PGNSP 81 PGUID 0 1255 0 0 0 0 0 f f f r 25 0 t f f f f f 3 _null_ _null_ ));
135 DATA(insert OID = 1259 ( pg_class PGNSP 83 PGUID 0 1259 0 0 0 0 0 f f f r 26 0 t f f f f f 3 _null_ _null_ ));
138 #define RELKIND_INDEX 'i' /* secondary index */
139 #define RELKIND_RELATION 'r' /* ordinary cataloged heap */
140 #define RELKIND_SEQUENCE 'S' /* SEQUENCE relation */
141 #define RELKIND_UNCATALOGED 'u' /* temporary heap */
142 #define RELKIND_TOASTVALUE 't' /* moved off huge values */
143 #define RELKIND_VIEW 'v' /* view */
144 #define RELKIND_COMPOSITE_TYPE 'c' /* composite type */
146 #endif /* PG_CLASS_H */