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
|
|
|
*
|
|
|
|
*
|
2001-01-24 20:43:33 +01:00
|
|
|
* Portions Copyright (c) 1996-2001, 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
|
|
|
*
|
2001-08-25 20:52:43 +02:00
|
|
|
* $Id: pg_class.h,v 1.53 2001/08/25 18:52:43 tgl Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
* NOTES
|
1997-09-07 07:04:48 +02:00
|
|
|
* the genbki.sh script reads this file and generates .bki
|
|
|
|
* 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
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* postgres.h contains the system type definintions and the
|
|
|
|
* CATALOG(), BOOTSTRAP and DATA() sugar words so this file
|
|
|
|
* can be read by both genbki.sh and the C compiler.
|
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
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* This structure is actually variable-length (the last attribute is
|
|
|
|
* a POSTGRES array). Hence, sizeof(FormData_pg_class) does not
|
2000-06-17 06:56:39 +02:00
|
|
|
* necessarily match the actual length of the structure. Furthermore
|
|
|
|
* relacl may be a NULL field. Hence, you MUST use heap_getattr()
|
|
|
|
* to get the relacl field ... and don't forget to check isNull.
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
CATALOG(pg_class) BOOTSTRAP
|
|
|
|
{
|
2001-08-10 20:57:42 +02:00
|
|
|
NameData relname; /* class name */
|
|
|
|
Oid reltype; /* OID of associated entry in pg_type */
|
|
|
|
int4 relowner; /* class owner */
|
|
|
|
Oid relam; /* index access method; 0 if not an index */
|
|
|
|
Oid relfilenode; /* identifier of physical storage file */
|
|
|
|
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 */
|
|
|
|
char relkind; /* see RELKIND_xxx constants below */
|
|
|
|
int2 relnatts; /* number of user attributes */
|
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
|
|
|
|
* (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 */
|
1997-09-08 04:41:22 +02:00
|
|
|
int2 reltriggers; /* # of TRIGGERs */
|
2001-05-30 16:40:13 +02:00
|
|
|
int2 relukeys; /* # of Unique keys (not used) */
|
|
|
|
int2 relfkeys; /* # of FOREIGN KEYs (not used) */
|
|
|
|
int2 relrefs; /* # of references to this rel (not used) */
|
2001-08-10 20:57:42 +02:00
|
|
|
bool relhasoids; /* T if we generate OIDs for rows of rel */
|
|
|
|
bool relhaspkey; /* has PRIMARY KEY index */
|
2000-06-17 06:56:39 +02:00
|
|
|
bool relhasrules; /* has associated rules */
|
2001-03-22 05:01:46 +01:00
|
|
|
bool relhassubclass; /* has derived classes */
|
2000-06-17 06:56:39 +02:00
|
|
|
/*
|
|
|
|
* relacl may or may not be present, see note above!
|
|
|
|
*/
|
|
|
|
aclitem relacl[1]; /* we declare this just for the catalog */
|
1996-08-28 03:59:28 +02:00
|
|
|
} FormData_pg_class;
|
|
|
|
|
2000-06-17 06:56:39 +02:00
|
|
|
/* Size of fixed part of pg_class tuples, not counting relacl or padding */
|
1996-08-28 03:59:28 +02:00
|
|
|
#define CLASS_TUPLE_SIZE \
|
2000-06-09 03:44:34 +02:00
|
|
|
(offsetof(FormData_pg_class,relhassubclass) + sizeof(bool))
|
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
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Natts_pg_class_fixed is used to tell routines that insert new
|
|
|
|
* pg_class tuples (as opposed to replacing old ones) that there's no
|
2001-08-10 20:57:42 +02:00
|
|
|
* relacl field. This is a kluge.
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
2001-08-10 20:57:42 +02:00
|
|
|
#define Natts_pg_class_fixed 22
|
|
|
|
#define Natts_pg_class 23
|
1997-09-07 07:04:48 +02:00
|
|
|
#define Anum_pg_class_relname 1
|
|
|
|
#define Anum_pg_class_reltype 2
|
|
|
|
#define Anum_pg_class_relowner 3
|
|
|
|
#define Anum_pg_class_relam 4
|
2000-10-16 16:52:28 +02:00
|
|
|
#define Anum_pg_class_relfilenode 5
|
|
|
|
#define Anum_pg_class_relpages 6
|
|
|
|
#define Anum_pg_class_reltuples 7
|
|
|
|
#define Anum_pg_class_reltoastrelid 8
|
|
|
|
#define Anum_pg_class_reltoastidxid 9
|
|
|
|
#define Anum_pg_class_relhasindex 10
|
|
|
|
#define Anum_pg_class_relisshared 11
|
|
|
|
#define Anum_pg_class_relkind 12
|
|
|
|
#define Anum_pg_class_relnatts 13
|
|
|
|
#define Anum_pg_class_relchecks 14
|
|
|
|
#define Anum_pg_class_reltriggers 15
|
|
|
|
#define Anum_pg_class_relukeys 16
|
|
|
|
#define Anum_pg_class_relfkeys 17
|
|
|
|
#define Anum_pg_class_relrefs 18
|
2001-08-10 20:57:42 +02:00
|
|
|
#define Anum_pg_class_relhasoids 19
|
|
|
|
#define Anum_pg_class_relhaspkey 20
|
|
|
|
#define Anum_pg_class_relhasrules 21
|
|
|
|
#define Anum_pg_class_relhassubclass 22
|
|
|
|
#define Anum_pg_class_relacl 23
|
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
|
|
|
*
|
|
|
|
* NOTE: only "bootstrapped" relations need to be declared here.
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
2001-08-10 20:57:42 +02:00
|
|
|
DATA(insert OID = 1247 ( pg_type 71 PGUID 0 1247 0 0 0 0 f f r 17 0 0 0 0 0 t f f f _null_ ));
|
1997-11-13 04:23:18 +01:00
|
|
|
DESCR("");
|
2001-08-10 20:57:42 +02:00
|
|
|
DATA(insert OID = 1249 ( pg_attribute 75 PGUID 0 1249 0 0 0 0 f f r 15 0 0 0 0 0 f f f f _null_ ));
|
1997-11-13 04:23:18 +01:00
|
|
|
DESCR("");
|
2001-08-10 20:57:42 +02:00
|
|
|
DATA(insert OID = 1255 ( pg_proc 81 PGUID 0 1255 0 0 0 0 f f r 17 0 0 0 0 0 t f f f _null_ ));
|
1997-11-13 04:23:18 +01:00
|
|
|
DESCR("");
|
2001-08-10 20:57:42 +02:00
|
|
|
DATA(insert OID = 1259 ( pg_class 83 PGUID 0 1259 0 0 0 0 f f r 23 0 0 0 0 0 t f f f _null_ ));
|
1997-11-13 04:23:18 +01:00
|
|
|
DESCR("");
|
2001-08-10 20:57:42 +02:00
|
|
|
DATA(insert OID = 1260 ( pg_shadow 86 PGUID 0 1260 0 0 0 0 f t r 8 0 0 0 0 0 f f f f _null_ ));
|
1997-11-13 04:23:18 +01:00
|
|
|
DESCR("");
|
2001-08-10 20:57:42 +02:00
|
|
|
DATA(insert OID = 1261 ( pg_group 87 PGUID 0 1261 0 0 0 0 f t r 3 0 0 0 0 0 f f f f _null_ ));
|
1997-11-13 04:23:18 +01:00
|
|
|
DESCR("");
|
2001-08-10 20:57:42 +02:00
|
|
|
DATA(insert OID = 1262 ( pg_database 88 PGUID 0 1262 0 0 0 0 f t r 7 0 0 0 0 0 t f f f _null_ ));
|
1997-11-13 04:23:18 +01:00
|
|
|
DESCR("");
|
2001-08-10 20:57:42 +02:00
|
|
|
DATA(insert OID = 376 ( pg_xactlock 0 PGUID 0 0 0 0 0 0 f t s 1 0 0 0 0 0 f f f f _null_ ));
|
1998-12-15 13:47:01 +01:00
|
|
|
DESCR("");
|
1997-09-07 07:04:48 +02:00
|
|
|
|
|
|
|
#define RelOid_pg_type 1247
|
|
|
|
#define RelOid_pg_attribute 1249
|
|
|
|
#define RelOid_pg_proc 1255
|
|
|
|
#define RelOid_pg_class 1259
|
1998-02-25 14:09:49 +01:00
|
|
|
#define RelOid_pg_shadow 1260
|
1997-09-07 07:04:48 +02:00
|
|
|
#define RelOid_pg_group 1261
|
|
|
|
#define RelOid_pg_database 1262
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1998-12-15 13:47:01 +01:00
|
|
|
/* Xact lock pseudo-table */
|
|
|
|
#define XactLockTableId 376
|
|
|
|
|
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_SPECIAL 's' /* special (non-heap) */
|
|
|
|
#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 */
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2000-06-17 06:56:39 +02:00
|
|
|
#endif /* PG_CLASS_H */
|