diff options
Diffstat (limited to 'src/include/utils/rel.h')
-rw-r--r-- | src/include/utils/rel.h | 56 |
1 files changed, 34 insertions, 22 deletions
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index c95f51e89d1..f2789b39e09 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: rel.h,v 1.25 1999/07/16 17:07:40 momjian Exp $ + * $Id: rel.h,v 1.26 1999/09/18 19:08:25 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,6 +20,26 @@ #include "rewrite/prs2lock.h" #include "storage/fd.h" + +/* + * LockRelId and LockInfo really belong to lmgr.h, but it's more convenient + * to declare them here so we can have a LockInfoData field in a Relation. + */ + +typedef struct LockRelId +{ + Oid relId; /* a relation identifier */ + Oid dbId; /* a database identifier */ +} LockRelId; + +typedef struct LockInfoData +{ + LockRelId lockRelId; +} LockInfoData; + +typedef LockInfoData *LockInfo; + + typedef struct Trigger { char *tgname; @@ -44,20 +64,21 @@ typedef struct TriggerDesc Trigger *triggers; } TriggerDesc; + typedef struct RelationData { File rd_fd; /* open file descriptor */ int rd_nblocks; /* number of blocks in rel */ uint16 rd_refcnt; /* reference count */ - bool rd_myxactonly; /* uses the local buffer mgr */ + bool rd_myxactonly; /* rel uses the local buffer mgr */ bool rd_isnailed; /* rel is nailed in cache */ bool rd_isnoname; /* rel has no name */ bool rd_nonameunlinked; /* noname rel already unlinked */ Form_pg_am rd_am; /* AM tuple */ Form_pg_class rd_rel; /* RELATION tuple */ - Oid rd_id; /* relations's object id */ - Pointer lockInfo; /* ptr. to misc. info. */ - TupleDesc rd_att; /* tuple desciptor */ + Oid rd_id; /* relation's object id */ + LockInfoData rd_lockInfo; /* lock manager's info for locking relation */ + TupleDesc rd_att; /* tuple descriptor */ RuleLock *rd_rules; /* rewrite rules */ IndexStrategy rd_istrat; RegProcedure *rd_support; @@ -66,6 +87,7 @@ typedef struct RelationData typedef RelationData *Relation; + /* ---------------- * RelationPtr is used in the executor to support index scans * where we have to keep track of several index relations in an @@ -74,7 +96,6 @@ typedef RelationData *Relation; */ typedef Relation *RelationPtr; -#define InvalidRelation ((Relation)NULL) /* * RelationIsValid @@ -82,6 +103,8 @@ typedef Relation *RelationPtr; */ #define RelationIsValid(relation) PointerIsValid(relation) +#define InvalidRelation ((Relation) NULL) + /* * RelationGetSystemPort * Returns system port of a relation. @@ -92,13 +115,6 @@ typedef Relation *RelationPtr; #define RelationGetSystemPort(relation) ((relation)->rd_fd) /* - * RelationGetLockInfo - * Returns the lock information structure in the reldesc - * - */ -#define RelationGetLockInfo(relation) ((relation)->lockInfo) - -/* * RelationHasReferenceCountZero * True iff relation reference count is zero. * @@ -112,13 +128,13 @@ typedef Relation *RelationPtr; * RelationSetReferenceCount * Sets relation reference count. */ -#define RelationSetReferenceCount(relation,count) ((relation)->rd_refcnt = count) +#define RelationSetReferenceCount(relation,count) ((relation)->rd_refcnt = (count)) /* * RelationIncrementReferenceCount * Increments relation reference count. */ -#define RelationIncrementReferenceCount(relation) ((relation)->rd_refcnt += 1); +#define RelationIncrementReferenceCount(relation) ((relation)->rd_refcnt += 1) /* * RelationDecrementReferenceCount @@ -135,7 +151,6 @@ typedef Relation *RelationPtr; */ #define RelationGetForm(relation) ((relation)->rd_rel) - /* * RelationGetRelid * @@ -151,7 +166,6 @@ typedef Relation *RelationPtr; */ #define RelationGetFile(relation) ((relation)->rd_fd) - /* * RelationGetRelationName * @@ -160,21 +174,19 @@ typedef Relation *RelationPtr; #define RelationGetRelationName(relation) (&(relation)->rd_rel->relname) /* - * RelationGetRelationName + * RelationGetNumberOfAttributes * - * Returns a the number of attributes. + * Returns the number of attributes. */ #define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts) /* * RelationGetDescr * Returns tuple descriptor for a relation. - * - * Note: - * Assumes relation descriptor is valid. */ #define RelationGetDescr(relation) ((relation)->rd_att) + extern IndexStrategy RelationGetIndexStrategy(Relation relation); extern void RelationSetIndexSupport(Relation relation, IndexStrategy strategy, |