1 /*-------------------------------------------------------------------------
4 * Relation descriptor cache definitions.
7 * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * $PostgreSQL: pgsql/src/include/utils/relcache.h,v 1.66 2010/01/02 16:58:10 momjian Exp $
12 *-------------------------------------------------------------------------
17 #include "access/tupdesc.h"
18 #include "nodes/bitmapset.h"
19 #include "nodes/pg_list.h"
22 typedef struct RelationData *Relation;
25 * RelationPtr is used in the executor to support index scans
26 * where we have to keep track of several index relations in an
30 typedef Relation *RelationPtr;
33 * Routines to open (lookup) and close a relcache entry
35 extern Relation RelationIdGetRelation(Oid relationId);
36 extern void RelationClose(Relation relation);
39 * Routines to compute/retrieve additional cached information
41 extern List *RelationGetIndexList(Relation relation);
42 extern Oid RelationGetOidIndex(Relation relation);
43 extern List *RelationGetIndexExpressions(Relation relation);
44 extern List *RelationGetIndexPredicate(Relation relation);
45 extern Bitmapset *RelationGetIndexAttrBitmap(Relation relation);
46 extern void RelationGetExclusionInfo(Relation indexRelation,
51 extern void RelationSetIndexList(Relation relation,
52 List *indexIds, Oid oidIndex);
54 extern void RelationInitIndexAccessInfo(Relation relation);
57 * Routines for backend startup
59 extern void RelationCacheInitialize(void);
60 extern void RelationCacheInitializePhase2(void);
61 extern void RelationCacheInitializePhase3(void);
64 * Routine to create a relcache entry for an about-to-be-created relation
66 extern Relation RelationBuildLocalRelation(const char *relname,
71 bool shared_relation);
74 * Routines for flushing/rebuilding relcache entries in various scenarios
76 extern void RelationForgetRelation(Oid rid);
78 extern void RelationCacheInvalidateEntry(Oid relationId);
80 extern void RelationCacheInvalidate(void);
82 extern void AtEOXact_RelationCache(bool isCommit);
83 extern void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid,
84 SubTransactionId parentSubid);
86 extern void RelationCacheMarkNewRelfilenode(Relation rel);
89 * Routines to help manage rebuilding of relcache init files
91 extern bool RelationIdIsInInitFile(Oid relationId);
92 extern void RelationCacheInitFileInvalidate(bool beforeSend);
93 extern void RelationCacheInitFileRemove(void);
95 /* should be used only by relcache.c and catcache.c */
96 extern bool criticalRelcachesBuilt;
97 /* should be used only by relcache.c and postinit.c */
98 extern bool criticalSharedRelcachesBuilt;
100 #endif /* RELCACHE_H */