1- $Header: /cvsroot/pgsql/src/backend/catalog/README,v 1.4 2002/03/22 20:14:42 tgl Exp $
1+ $Header: /cvsroot/pgsql/src/backend/catalog/README,v 1.5 2002/04/08 22:09:05 tgl Exp $
22
33This directory contains .c files that manipulate the system catalogs
44as well as .h files that define the structure of the system catalogs.
@@ -27,9 +27,9 @@ of cross-references from other pre-loaded tuples. For example, pg_type
2727contains pointers into pg_proc (e.g., pg_type.typinput), and pg_proc
2828contains back-pointers into pg_type (pg_proc.proargtypes). For such
2929cases, the OID assigned to a tuple may be explicitly set by use of the
30- "OID =" clause of the .bki insert statement. If no such pointers are
31- required to a given tuple, then the OIDmay be set to the wildcard value 0
32- (i.e., the system generates a random OID in the usual way, or leaves it
30+ "OID = n " clause of the .bki insert statement. If no such pointers are
31+ required to a given tuple, then the OID= n clause may be omitted
32+ (then the system generates a random OID in the usual way, or leaves it
33330 in a catalog that has no OIDs). In practice we usually preassign OIDs
3434for all or none of the pre-loaded tuples in a given catalog, even if only
3535some of them are actually cross-referenced.
@@ -39,16 +39,28 @@ be known directly in the C code. In such cases, put a #define in the
3939catalog's .h file, and use the #define symbol in the C code. Writing
4040the actual numeric value of any OID in C code is considered very bad form.
4141(Direct references to pg_proc OIDs are common enough that there's a special
42- mechanism to create the necessary #define's automatically. For all the
43- other system catalogs, you have to manually create any #define's you need.)
42+ mechanism to create the necessary #define's automatically: see
43+ backend/utils/Gen_fmgrtab.sh. For all the other system catalogs, you have
44+ to manually create any #define's you need.)
4445
4546- If you need to find a valid OID for a tuple that will be referred to by
4647others, use the unused_oids script. It generates inclusive ranges of
47- *unused* OIDs (i.e ., the line "45-900" means OIDs 45 through 900 have
48+ *unused* OIDs (e.g ., the line "45-900" means OIDs 45 through 900 have
4849not been allocated yet). Currently, OIDs 1-9999 are reserved for manual
4950assignment; the unused_oids script simply looks through the include/catalog
5051headers to see which ones do not appear in "OID =" clauses.
5152
53+ - OIDs 10000-16383 are reserved for assignment by the genbki.sh script:
54+ it will insert these OIDs if it sees a clause "OID = 0" in a DATA
55+ statement. You would typically use this feature if you don't care exactly
56+ which OID is assigned to a catalog row (because it has no cross-references
57+ you need to hardwire) but you want to give it a DESCR entry. The DESCR macro
58+ will not work for rows that don't have any OID at genbki.sh time.
59+
60+ - The OID counter starts at 16384 at bootstrap. If a catalog row is in a
61+ table that requires OIDs, but no OID was preassigned by hand or by genbki.sh,
62+ then it will receive an OID of 16384 or above.
63+
5264- To create a "BOOTSTRAP" table you have to do a lot of extra work: these
5365tables are not created through a normal CREATE TABLE operation, but spring
5466into existence when first written to during initdb. Therefore, you must
@@ -58,7 +70,7 @@ heap_create() in heap.c to force the correct OID to be assigned when the table
5870is first referenced. (It's near the top of the function with the comment
5971beginning in 'Real ugly stuff'.) Avoid making new catalogs be bootstrap
6072catalogs if at all possible; generally, only tables that must be written to
61- to create a table should be bootstrapped.
73+ in order to create a table should be bootstrapped.
6274
6375- Certain BOOTSTRAP tables must be at the start of the Makefile
6476POSTGRES_BKI_SRCS variable, as these will not be created through standard