]> granicus.if.org Git - postgresql/blob - src/include/utils/relcache.h
Update copyrights for 2013
[postgresql] / src / include / utils / relcache.h
1 /*-------------------------------------------------------------------------
2  *
3  * relcache.h
4  *        Relation descriptor cache definitions.
5  *
6  *
7  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/utils/relcache.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef RELCACHE_H
15 #define RELCACHE_H
16
17 #include "access/tupdesc.h"
18 #include "nodes/bitmapset.h"
19
20
21 typedef struct RelationData *Relation;
22
23 /* ----------------
24  *              RelationPtr is used in the executor to support index scans
25  *              where we have to keep track of several index relations in an
26  *              array.  -cim 9/10/89
27  * ----------------
28  */
29 typedef Relation *RelationPtr;
30
31 /*
32  * Routines to open (lookup) and close a relcache entry
33  */
34 extern Relation RelationIdGetRelation(Oid relationId);
35 extern void RelationClose(Relation relation);
36
37 /*
38  * Routines to compute/retrieve additional cached information
39  */
40 extern List *RelationGetIndexList(Relation relation);
41 extern Oid      RelationGetOidIndex(Relation relation);
42 extern List *RelationGetIndexExpressions(Relation relation);
43 extern List *RelationGetIndexPredicate(Relation relation);
44 extern Bitmapset *RelationGetIndexAttrBitmap(Relation relation);
45 extern void RelationGetExclusionInfo(Relation indexRelation,
46                                                  Oid **operators,
47                                                  Oid **procs,
48                                                  uint16 **strategies);
49
50 extern void RelationSetIndexList(Relation relation,
51                                          List *indexIds, Oid oidIndex);
52
53 extern void RelationInitIndexAccessInfo(Relation relation);
54
55 /*
56  * Routines for backend startup
57  */
58 extern void RelationCacheInitialize(void);
59 extern void RelationCacheInitializePhase2(void);
60 extern void RelationCacheInitializePhase3(void);
61
62 /*
63  * Routine to create a relcache entry for an about-to-be-created relation
64  */
65 extern Relation RelationBuildLocalRelation(const char *relname,
66                                                    Oid relnamespace,
67                                                    TupleDesc tupDesc,
68                                                    Oid relid,
69                                                    Oid relfilenode,
70                                                    Oid reltablespace,
71                                                    bool shared_relation,
72                                                    bool mapped_relation,
73                                                    char relpersistence,
74                                                    char relkind);
75
76 /*
77  * Routine to manage assignment of new relfilenode to a relation
78  */
79 extern void RelationSetNewRelfilenode(Relation relation,
80                                                   TransactionId freezeXid);
81
82 /*
83  * Routines for flushing/rebuilding relcache entries in various scenarios
84  */
85 extern void RelationForgetRelation(Oid rid);
86
87 extern void RelationCacheInvalidateEntry(Oid relationId);
88
89 extern void RelationCacheInvalidate(void);
90
91 extern void RelationCloseSmgrByOid(Oid relationId);
92
93 extern void AtEOXact_RelationCache(bool isCommit);
94 extern void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid,
95                                                   SubTransactionId parentSubid);
96
97 /*
98  * Routines to help manage rebuilding of relcache init files
99  */
100 extern bool RelationIdIsInInitFile(Oid relationId);
101 extern void RelationCacheInitFilePreInvalidate(void);
102 extern void RelationCacheInitFilePostInvalidate(void);
103 extern void RelationCacheInitFileRemove(void);
104
105 /* should be used only by relcache.c and catcache.c */
106 extern bool criticalRelcachesBuilt;
107
108 /* should be used only by relcache.c and postinit.c */
109 extern bool criticalSharedRelcachesBuilt;
110
111 #endif   /* RELCACHE_H */