diff options
Diffstat (limited to 'src/include/storage/relfilenode.h')
-rw-r--r-- | src/include/storage/relfilenode.h | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/src/include/storage/relfilenode.h b/src/include/storage/relfilenode.h index 715dc00f7de..d430412e67f 100644 --- a/src/include/storage/relfilenode.h +++ b/src/include/storage/relfilenode.h @@ -1,22 +1,60 @@ +/*------------------------------------------------------------------------- + * + * relfilenode.h + * Physical access information for relations. + * + * + * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * $PostgreSQL: pgsql/src/include/storage/relfilenode.h,v 1.9 2004/06/18 06:14:13 tgl Exp $ + * + *------------------------------------------------------------------------- + */ #ifndef RELFILENODE_H #define RELFILENODE_H /* - * This is all what we need to know to find relation file. - * tblNode is identificator of tablespace and because of - * currently our tablespaces are equal to databases this is - * database OID. relNode is currently relation OID on creation - * but may be changed later if required. relNode is stored in - * pg_class.relfilenode. + * RelFileNode must provide all that we need to know to physically access + * a relation. + * + * spcNode identifies the tablespace of the relation. It corresponds to + * pg_tablespace.oid. + * + * dbNode identifies the database of the relation. It is zero for + * "shared" relations (those common to all databases of a cluster). + * Nonzero dbNode values correspond to pg_database.oid. + * + * relNode identifies the specific relation. relNode corresponds to + * pg_class.relfilenode (NOT pg_class.oid, because we need to be able + * to assign new physical files to relations in some situations). + * Notice that relNode is only unique within a particular database. + * + * Note: spcNode must be GLOBALTABLESPACE_OID if and only if dbNode is + * zero. We support shared relations only in the "global" tablespace. + * + * Note: in pg_class we allow reltablespace == 0 to denote that the + * relation is stored in its database's "default" tablespace (as + * identified by pg_database.dattablespace). However this shorthand + * is NOT allowed in RelFileNode structs --- the real tablespace ID + * must be supplied when setting spcNode. */ typedef struct RelFileNode { - Oid tblNode; /* tablespace */ + Oid spcNode; /* tablespace */ + Oid dbNode; /* database */ Oid relNode; /* relation */ } RelFileNode; +/* + * Note: RelFileNodeEquals compares relNode first since that is most likely + * to be different in two unequal RelFileNodes. It is probably redundant + * to compare spcNode if the other two fields are found equal, but do it + * anyway to be sure. + */ #define RelFileNodeEquals(node1, node2) \ ((node1).relNode == (node2).relNode && \ - (node1).tblNode == (node2).tblNode) + (node1).dbNode == (node2).dbNode && \ + (node1).spcNode == (node2).spcNode) -#endif /* RELFILENODE_H */ +#endif /* RELFILENODE_H */ |