1 /*-------------------------------------------------------------------------
4 * Relation descriptor cache definitions.
7 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
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
);
47 extern void RelationSetIndexList(Relation relation
,
48 List
*indexIds
, Oid oidIndex
);
50 extern void RelationInitIndexAccessInfo(Relation relation
);
53 * Routines for backend startup
55 extern void RelationCacheInitialize(void);
56 extern void RelationCacheInitializePhase2(void);
59 * Routine to create a relcache entry for an about-to-be-created relation
61 extern Relation
RelationBuildLocalRelation(const char *relname
,
66 bool shared_relation
);
69 * Routines for flushing/rebuilding relcache entries in various scenarios
71 extern void RelationForgetRelation(Oid rid
);
73 extern void RelationCacheInvalidateEntry(Oid relationId
);
75 extern void RelationCacheInvalidate(void);
77 extern void AtEOXact_RelationCache(bool isCommit
);
78 extern void AtEOSubXact_RelationCache(bool isCommit
, SubTransactionId mySubid
,
79 SubTransactionId parentSubid
);
81 extern void RelationCacheMarkNewRelfilenode(Relation rel
);
84 * Routines to help manage rebuilding of relcache init file
86 extern bool RelationIdIsInInitFile(Oid relationId
);
87 extern void RelationCacheInitFileInvalidate(bool beforeSend
);
88 extern void RelationCacheInitFileRemove(const char *dbPath
);
90 /* should be used only by relcache.c and catcache.c */
91 extern bool criticalRelcachesBuilt
;
93 #endif /* RELCACHE_H */