summaryrefslogtreecommitdiff
path: root/src/include/catalog/pg_description.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-08-10 18:57:42 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-08-10 18:57:42 +0000
commitbf56f0759bdfa87f143c3abd09f893a5f530fe88 (patch)
tree10555a5e46bcfdfd9799b8f0e13ab48101d766de /src/include/catalog/pg_description.h
parentd062f0f4e91f68b1f55b04691bd92d1efc83dc54 (diff)
downloadpostgresql-bf56f0759bdfa87f143c3abd09f893a5f530fe88.tar.gz
Make OIDs optional, per discussions in pghackers. WITH OIDS is still the
default, but OIDS are removed from many system catalogs that don't need them. Some interesting side effects: TOAST pointers are 20 bytes not 32 now; pg_description has a three-column key instead of one. Bugs fixed in passing: BINARY cursors work again; pg_class.relhaspkey has some usefulness; pg_dump dumps comments on indexes, rules, and triggers in a valid order. initdb forced.
Diffstat (limited to 'src/include/catalog/pg_description.h')
-rw-r--r--src/include/catalog/pg_description.h35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/include/catalog/pg_description.h b/src/include/catalog/pg_description.h
index 0b5d342c0d..e3f21a49b6 100644
--- a/src/include/catalog/pg_description.h
+++ b/src/include/catalog/pg_description.h
@@ -3,11 +3,26 @@
* pg_description.h
* definition of the system "description" relation (pg_description)
*
+ * NOTE: an object is identified by the OID of the row that primarily
+ * defines the object, plus the OID of the table that that row appears in.
+ * For example, a function is identified by the OID of its pg_proc row
+ * plus the pg_class OID of table pg_proc. This allows unique identification
+ * of objects without assuming that OIDs are unique across tables.
+ *
+ * Since attributes don't have OIDs of their own, we identify an attribute
+ * comment by the objoid+classoid of its parent table, plus an "objsubid"
+ * giving the attribute column number. "objsubid" must be zero in a comment
+ * for a table itself, so that it is distinct from any column comment.
+ * Currently, objsubid is unused and zero for all other kinds of objects,
+ * but perhaps it might be useful someday to associate comments with
+ * constituent elements of other kinds of objects (arguments of a function,
+ * for example).
+ *
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_description.h,v 1.12 2001/01/24 19:43:21 momjian Exp $
+ * $Id: pg_description.h,v 1.13 2001/08/10 18:57:40 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -33,10 +48,12 @@
* typedef struct FormData_pg_description
* ----------------
*/
-CATALOG(pg_description)
+CATALOG(pg_description) BKI_WITHOUT_OIDS
{
- Oid objoid;
- text description;
+ Oid objoid; /* OID of object itself */
+ Oid classoid; /* OID of table containing object */
+ int4 objsubid; /* column number, or 0 if not used */
+ text description; /* description of object */
} FormData_pg_description;
/* ----------------
@@ -50,9 +67,11 @@ typedef FormData_pg_description *Form_pg_description;
* compiler constants for pg_descrpition
* ----------------
*/
-#define Natts_pg_description 2
+#define Natts_pg_description 4
#define Anum_pg_description_objoid 1
-#define Anum_pg_description_description 2
+#define Anum_pg_description_classoid 2
+#define Anum_pg_description_objsubid 3
+#define Anum_pg_description_description 4
/* ----------------
* initial contents of pg_description
@@ -61,8 +80,8 @@ typedef FormData_pg_description *Form_pg_description;
/*
* Because the contents of this table are taken from the other *.h files,
- * there is no initialization. It is loaded from initdb using a COPY
- * statement.
+ * there is no initialization here. The initial contents are extracted
+ * by genbki.sh and loaded during initdb.
*/
#endif /* PG_DESCRIPTION_H */