1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* pg_class.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* definition of the system "relation" relation (pg_class)
|
|
|
|
* along with the relation's initial contents.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
2011-01-01 19:18:15 +01:00
|
|
|
* Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2010-09-20 22:08:53 +02:00
|
|
|
* src/include/catalog/pg_class.h
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
* NOTES
|
2010-01-05 02:06:57 +01:00
|
|
|
* the genbki.pl script reads this file and generates .bki
|
1997-09-07 07:04:48 +02:00
|
|
|
* information from the DATA() statements.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2000-06-17 06:56:39 +02:00
|
|
|
#ifndef PG_CLASS_H
|
|
|
|
#define PG_CLASS_H
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2008-03-27 04:57:34 +01:00
|
|
|
#include "catalog/genbki.h"
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* pg_class definition. cpp turns this into
|
|
|
|
* typedef struct FormData_pg_class
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
2005-10-15 04:49:52 +02:00
|
|
|
#define RelationRelationId 1259
|
2009-09-27 00:42:03 +02:00
|
|
|
#define RelationRelation_Rowtype_Id 83
|
2005-04-14 03:38:22 +02:00
|
|
|
|
2010-01-05 02:06:57 +01:00
|
|
|
CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO
|
1997-09-07 07:04:48 +02:00
|
|
|
{
|
2001-08-10 20:57:42 +02:00
|
|
|
NameData relname; /* class name */
|
2002-03-26 20:17:02 +01:00
|
|
|
Oid relnamespace; /* OID of namespace containing this class */
|
2010-02-26 03:01:40 +01:00
|
|
|
Oid reltype; /* OID of entry in pg_type for table's
|
|
|
|
* implicit row type */
|
|
|
|
Oid reloftype; /* OID of entry in pg_type for underlying
|
|
|
|
* composite type */
|
2005-06-28 07:09:14 +02:00
|
|
|
Oid relowner; /* class owner */
|
2001-08-10 20:57:42 +02:00
|
|
|
Oid relam; /* index access method; 0 if not an index */
|
|
|
|
Oid relfilenode; /* identifier of physical storage file */
|
2010-02-26 03:01:40 +01:00
|
|
|
|
2010-02-07 21:48:13 +01:00
|
|
|
/* relfilenode == 0 means it is a "mapped" relation, see relmapper.c */
|
2004-06-18 08:14:31 +02:00
|
|
|
Oid reltablespace; /* identifier of table space for relation */
|
2001-08-10 20:57:42 +02:00
|
|
|
int4 relpages; /* # of blocks (not always up-to-date) */
|
|
|
|
float4 reltuples; /* # of tuples (not always up-to-date) */
|
|
|
|
Oid reltoastrelid; /* OID of toast table; 0 if none */
|
|
|
|
Oid reltoastidxid; /* if toast table, OID of chunk_id index */
|
|
|
|
bool relhasindex; /* T if has (or has had) any indexes */
|
|
|
|
bool relisshared; /* T if shared across databases */
|
2010-12-13 18:34:26 +01:00
|
|
|
char relpersistence; /* see RELPERSISTENCE_xxx constants */
|
2001-08-10 20:57:42 +02:00
|
|
|
char relkind; /* see RELKIND_xxx constants below */
|
|
|
|
int2 relnatts; /* number of user attributes */
|
2001-10-25 07:50:21 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*
|
2001-08-10 20:57:42 +02:00
|
|
|
* Class pg_attribute must contain exactly "relnatts" user attributes
|
2005-10-15 04:49:52 +02:00
|
|
|
* (with attnums ranging from 1 to relnatts) for this class. It may also
|
|
|
|
* contain entries with negative attnums for system attributes.
|
1997-09-07 07:04:48 +02:00
|
|
|
*/
|
2000-06-17 06:56:39 +02:00
|
|
|
int2 relchecks; /* # of CHECK constraints for class */
|
2001-08-10 20:57:42 +02:00
|
|
|
bool relhasoids; /* T if we generate OIDs for rows of rel */
|
2008-11-09 22:24:33 +01:00
|
|
|
bool relhaspkey; /* has (or has had) PRIMARY KEY index */
|
|
|
|
bool relhasrules; /* has (or has had) any rules */
|
2009-06-11 16:49:15 +02:00
|
|
|
bool relhastriggers; /* has (or has had) any TRIGGERs */
|
2008-11-09 22:24:33 +01:00
|
|
|
bool relhassubclass; /* has (or has had) derived classes */
|
2007-11-15 22:14:46 +01:00
|
|
|
TransactionId relfrozenxid; /* all Xids < this are frozen in this rel */
|
2001-10-25 07:50:21 +02:00
|
|
|
|
2006-07-04 00:45:41 +02:00
|
|
|
/*
|
|
|
|
* VARIABLE LENGTH FIELDS start here. These fields may be NULL, too.
|
|
|
|
*
|
|
|
|
* NOTE: these fields are not present in a relcache entry's rd_rel field.
|
|
|
|
*/
|
|
|
|
|
|
|
|
aclitem relacl[1]; /* access permissions */
|
|
|
|
text reloptions[1]; /* access-method-specific options */
|
1996-08-28 03:59:28 +02:00
|
|
|
} FormData_pg_class;
|
|
|
|
|
2006-07-04 00:45:41 +02:00
|
|
|
/* Size of fixed part of pg_class tuples, not counting var-length fields */
|
1996-08-28 03:59:28 +02:00
|
|
|
#define CLASS_TUPLE_SIZE \
|
Fix recently-understood problems with handling of XID freezing, particularly
in PITR scenarios. We now WAL-log the replacement of old XIDs with
FrozenTransactionId, so that such replacement is guaranteed to propagate to
PITR slave databases. Also, rather than relying on hint-bit updates to be
preserved, pg_clog is not truncated until all instances of an XID are known to
have been replaced by FrozenTransactionId. Add new GUC variables and
pg_autovacuum columns to allow management of the freezing policy, so that
users can trade off the size of pg_clog against the amount of freezing work
done. Revise the already-existing code that forces autovacuum of tables
approaching the wraparound point to make it more bulletproof; also, revise the
autovacuum logic so that anti-wraparound vacuuming is done per-table rather
than per-database. initdb forced because of changes in pg_class, pg_database,
and pg_autovacuum catalogs. Heikki Linnakangas, Simon Riggs, and Tom Lane.
2006-11-05 23:42:10 +01:00
|
|
|
(offsetof(FormData_pg_class,relfrozenxid) + sizeof(TransactionId))
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Form_pg_class corresponds to a pointer to a tuple with
|
|
|
|
* the format of pg_class relation.
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef FormData_pg_class *Form_pg_class;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* compiler constants for pg_class
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
2011-01-25 23:51:59 +01:00
|
|
|
#define Natts_pg_class 26
|
1997-09-07 07:04:48 +02:00
|
|
|
#define Anum_pg_class_relname 1
|
2002-03-26 20:17:02 +01:00
|
|
|
#define Anum_pg_class_relnamespace 2
|
|
|
|
#define Anum_pg_class_reltype 3
|
2010-01-29 00:21:13 +01:00
|
|
|
#define Anum_pg_class_reloftype 4
|
|
|
|
#define Anum_pg_class_relowner 5
|
|
|
|
#define Anum_pg_class_relam 6
|
|
|
|
#define Anum_pg_class_relfilenode 7
|
|
|
|
#define Anum_pg_class_reltablespace 8
|
|
|
|
#define Anum_pg_class_relpages 9
|
|
|
|
#define Anum_pg_class_reltuples 10
|
|
|
|
#define Anum_pg_class_reltoastrelid 11
|
|
|
|
#define Anum_pg_class_reltoastidxid 12
|
|
|
|
#define Anum_pg_class_relhasindex 13
|
|
|
|
#define Anum_pg_class_relisshared 14
|
2010-12-13 18:34:26 +01:00
|
|
|
#define Anum_pg_class_relpersistence 15
|
2010-01-29 00:21:13 +01:00
|
|
|
#define Anum_pg_class_relkind 16
|
|
|
|
#define Anum_pg_class_relnatts 17
|
|
|
|
#define Anum_pg_class_relchecks 18
|
|
|
|
#define Anum_pg_class_relhasoids 19
|
|
|
|
#define Anum_pg_class_relhaspkey 20
|
2011-01-25 23:51:59 +01:00
|
|
|
#define Anum_pg_class_relhasrules 21
|
|
|
|
#define Anum_pg_class_relhastriggers 22
|
|
|
|
#define Anum_pg_class_relhassubclass 23
|
|
|
|
#define Anum_pg_class_relfrozenxid 24
|
|
|
|
#define Anum_pg_class_relacl 25
|
|
|
|
#define Anum_pg_class_reloptions 26
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* initial contents of pg_class
|
2001-06-12 07:55:50 +02:00
|
|
|
*
|
2005-04-14 03:38:22 +02:00
|
|
|
* NOTE: only "bootstrapped" relations need to be declared here. Be sure that
|
Fix recently-understood problems with handling of XID freezing, particularly
in PITR scenarios. We now WAL-log the replacement of old XIDs with
FrozenTransactionId, so that such replacement is guaranteed to propagate to
PITR slave databases. Also, rather than relying on hint-bit updates to be
preserved, pg_clog is not truncated until all instances of an XID are known to
have been replaced by FrozenTransactionId. Add new GUC variables and
pg_autovacuum columns to allow management of the freezing policy, so that
users can trade off the size of pg_clog against the amount of freezing work
done. Revise the already-existing code that forces autovacuum of tables
approaching the wraparound point to make it more bulletproof; also, revise the
autovacuum logic so that anti-wraparound vacuuming is done per-table rather
than per-database. initdb forced because of changes in pg_class, pg_database,
and pg_autovacuum catalogs. Heikki Linnakangas, Simon Riggs, and Tom Lane.
2006-11-05 23:42:10 +01:00
|
|
|
* the OIDs listed here match those given in their CATALOG macros, and that
|
|
|
|
* the relnatts values are correct.
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
Fix recently-understood problems with handling of XID freezing, particularly
in PITR scenarios. We now WAL-log the replacement of old XIDs with
FrozenTransactionId, so that such replacement is guaranteed to propagate to
PITR slave databases. Also, rather than relying on hint-bit updates to be
preserved, pg_clog is not truncated until all instances of an XID are known to
have been replaced by FrozenTransactionId. Add new GUC variables and
pg_autovacuum columns to allow management of the freezing policy, so that
users can trade off the size of pg_clog against the amount of freezing work
done. Revise the already-existing code that forces autovacuum of tables
approaching the wraparound point to make it more bulletproof; also, revise the
autovacuum logic so that anti-wraparound vacuuming is done per-table rather
than per-database. initdb forced because of changes in pg_class, pg_database,
and pg_autovacuum catalogs. Heikki Linnakangas, Simon Riggs, and Tom Lane.
2006-11-05 23:42:10 +01:00
|
|
|
/* Note: "3" in the relfrozenxid column stands for FirstNormalTransactionId */
|
2011-01-25 23:51:59 +01:00
|
|
|
DATA(insert OID = 1247 ( pg_type PGNSP 71 0 PGUID 0 0 0 0 0 0 0 f f p r 28 0 t f f f f 3 _null_ _null_ ));
|
1997-11-13 04:23:18 +01:00
|
|
|
DESCR("");
|
2011-01-25 23:51:59 +01:00
|
|
|
DATA(insert OID = 1249 ( pg_attribute PGNSP 75 0 PGUID 0 0 0 0 0 0 0 f f p r 19 0 f f f f f 3 _null_ _null_ ));
|
1997-11-13 04:23:18 +01:00
|
|
|
DESCR("");
|
2011-01-25 23:51:59 +01:00
|
|
|
DATA(insert OID = 1255 ( pg_proc PGNSP 81 0 PGUID 0 0 0 0 0 0 0 f f p r 25 0 t f f f f 3 _null_ _null_ ));
|
1997-11-13 04:23:18 +01:00
|
|
|
DESCR("");
|
2011-01-25 23:51:59 +01:00
|
|
|
DATA(insert OID = 1259 ( pg_class PGNSP 83 0 PGUID 0 0 0 0 0 0 0 f f p r 26 0 t f f f f 3 _null_ _null_ ));
|
1997-11-13 04:23:18 +01:00
|
|
|
DESCR("");
|
1998-12-15 13:47:01 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define RELKIND_INDEX 'i' /* secondary index */
|
2000-06-17 06:56:39 +02:00
|
|
|
#define RELKIND_RELATION 'r' /* ordinary cataloged heap */
|
1997-09-07 07:04:48 +02:00
|
|
|
#define RELKIND_SEQUENCE 'S' /* SEQUENCE relation */
|
|
|
|
#define RELKIND_UNCATALOGED 'u' /* temporary heap */
|
2000-07-04 01:10:14 +02:00
|
|
|
#define RELKIND_TOASTVALUE 't' /* moved off huge values */
|
2000-10-16 18:19:14 +02:00
|
|
|
#define RELKIND_VIEW 'v' /* view */
|
2002-08-15 18:36:08 +02:00
|
|
|
#define RELKIND_COMPOSITE_TYPE 'c' /* composite type */
|
2011-01-02 05:48:11 +01:00
|
|
|
#define RELKIND_FOREIGN_TABLE 'f' /* foreign table */
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2010-12-13 18:34:26 +01:00
|
|
|
#define RELPERSISTENCE_PERMANENT 'p'
|
2010-12-29 12:48:53 +01:00
|
|
|
#define RELPERSISTENCE_UNLOGGED 'u'
|
2010-12-13 18:34:26 +01:00
|
|
|
#define RELPERSISTENCE_TEMP 't'
|
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* PG_CLASS_H */
|