2004-06-18 08:14:31 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* relfilenode.h
|
|
|
|
* Physical access information for relations.
|
|
|
|
*
|
|
|
|
*
|
2008-01-01 20:46:01 +01:00
|
|
|
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
2004-06-18 08:14:31 +02:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
2008-01-01 20:46:01 +01:00
|
|
|
* $PostgreSQL: pgsql/src/include/storage/relfilenode.h,v 1.15 2008/01/01 19:45:59 momjian Exp $
|
2004-06-18 08:14:31 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2000-09-10 02:06:52 +02:00
|
|
|
#ifndef RELFILENODE_H
|
|
|
|
#define RELFILENODE_H
|
|
|
|
|
|
|
|
/*
|
2004-06-18 08:14:31 +02:00
|
|
|
* 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.
|
|
|
|
*
|
2004-08-29 07:07:03 +02:00
|
|
|
* dbNode identifies the database of the relation. It is zero for
|
2004-06-18 08:14:31 +02:00
|
|
|
* "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.
|
2000-09-10 02:06:52 +02:00
|
|
|
*/
|
|
|
|
typedef struct RelFileNode
|
|
|
|
{
|
2004-06-18 08:14:31 +02:00
|
|
|
Oid spcNode; /* tablespace */
|
|
|
|
Oid dbNode; /* database */
|
2001-03-22 05:01:46 +01:00
|
|
|
Oid relNode; /* relation */
|
2000-09-10 02:06:52 +02:00
|
|
|
} RelFileNode;
|
|
|
|
|
2004-06-18 08:14:31 +02:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2001-03-22 05:01:46 +01:00
|
|
|
#define RelFileNodeEquals(node1, node2) \
|
2000-10-18 07:50:16 +02:00
|
|
|
((node1).relNode == (node2).relNode && \
|
2004-06-18 08:14:31 +02:00
|
|
|
(node1).dbNode == (node2).dbNode && \
|
|
|
|
(node1).spcNode == (node2).spcNode)
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2004-08-29 07:07:03 +02:00
|
|
|
#endif /* RELFILENODE_H */
|