Fix some incorrect and obsolete commentary.

This commit is contained in:
Tom Lane 2002-01-04 17:06:51 +00:00
parent c5c28ed06a
commit 1aff1d30d6

View File

@ -1,4 +1,4 @@
$Header: /cvsroot/pgsql/src/backend/catalog/README,v 1.1.1.1 1996/07/09 06:21:15 scrappy Exp $
$Header: /cvsroot/pgsql/src/backend/catalog/README,v 1.2 2002/01/04 17:06:51 tgl Exp $
This directory contains .c files that manipulate the system catalogs
as well as .h files that define the structure of the system catalogs.
@ -29,7 +29,8 @@ contains back-pointers into pg_type (pg_proc.proargtypes). In these
cases, the references may be explicitly set by use of the "OID ="
clause of the .bki insert statement. If no such pointers are required
to a given tuple, then the OID may be set to the wildcard value 0
(i.e., the system generates a random OID in the usual way).
(i.e., the system generates a random OID in the usual way, or leaves it
0 in a catalog that has no OIDs).
If you need to find a valid OID for a set of tuples that refer to each
other, use the unused_oids script. It generates inclusive ranges of
@ -38,17 +39,21 @@ not been allocated yet). However, you should not rely 100% on this
script, since it only looks at the .h files in the catalog/ directory.
Do a pg_grepsrc (recursive grep) of the source tree to insure that
there aren't any hidden crocks (i.e., explicit use of a numeric OID)
anywhere in the code.
anywhere in the code. (tgl 1/2002: that advice is obsolete; there are
no hardcoded uses of OIDs in the C files anymore. All OIDs that are known
directly to C code should be referenced via #defines in the catalog .h files.
So unused_oids is sufficient for assigning new OIDs.)
-----------------------------------------------------------------
When munging the .c files, you should be aware of certain conventions:
- The system catalog cache code (and most catalog-munging code in
general) assumes that the fixed-length portion of all system catalog
tuples are in fact present. That is, only the variable-length
portions of a catalog tuple are assumed to be permitted to be
non-NULL. For example, if you set pg_type.typdelim to be NULL, a
general) assumes that the fixed-length portions of all system catalog
tuples are in fact present, because it maps C struct declarations onto
them. Thus, the variable-length fields must all be at the end, and
only the variable-length fields of a catalog tuple are permitted to be
NULL. For example, if you set pg_type.typdelim to be NULL, a
piece of code will likely perform "typetup->typdelim" (or, worse,
"typetyp->typelem", which follows typdelim). This will result in
random errors or even segmentation violations. Hence, do NOT insert
@ -56,7 +61,7 @@ catalog tuples that contain NULL attributes except in their
variable-length portions!
- Modification of the catalogs must be performed with the proper
updating of catalog indexes! That is, several catalogs have indexes
updating of catalog indexes! That is, most catalogs have indexes
on them; when you munge them using the executor, the executor will
take care of doing the index updates, but if you make direct access
method calls to insert new or modified tuples into a heap, you must