]> granicus.if.org Git - postgresql/blob - src/include/utils/relcache.h
Fix 3-parameter form of bit substring() to throw error for negative length,
[postgresql] / src / include / utils / relcache.h
1 /*-------------------------------------------------------------------------
2  *
3  * relcache.h
4  *        Relation descriptor cache definitions.
5  *
6  *
7  * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * $PostgreSQL: pgsql/src/include/utils/relcache.h,v 1.66 2010/01/02 16:58:10 momjian Exp $
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef RELCACHE_H
15 #define RELCACHE_H
16
17 #include "access/tupdesc.h"
18 #include "nodes/bitmapset.h"
19 #include "nodes/pg_list.h"
20
21
22 typedef struct RelationData *Relation;
23
24 /* ----------------
25  *              RelationPtr is used in the executor to support index scans
26  *              where we have to keep track of several index relations in an
27  *              array.  -cim 9/10/89
28  * ----------------
29  */
30 typedef Relation *RelationPtr;
31
32 /*
33  * Routines to open (lookup) and close a relcache entry
34  */
35 extern Relation RelationIdGetRelation(Oid relationId);
36 extern void RelationClose(Relation relation);
37
38 /*
39  * Routines to compute/retrieve additional cached information
40  */
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,
47                                                                          Oid **operators,
48                                                                          Oid **procs,
49                                                                          uint16 **strategies);
50
51 extern void RelationSetIndexList(Relation relation,
52                                          List *indexIds, Oid oidIndex);
53
54 extern void RelationInitIndexAccessInfo(Relation relation);
55
56 /*
57  * Routines for backend startup
58  */
59 extern void RelationCacheInitialize(void);
60 extern void RelationCacheInitializePhase2(void);
61 extern void RelationCacheInitializePhase3(void);
62
63 /*
64  * Routine to create a relcache entry for an about-to-be-created relation
65  */
66 extern Relation RelationBuildLocalRelation(const char *relname,
67                                                    Oid relnamespace,
68                                                    TupleDesc tupDesc,
69                                                    Oid relid,
70                                                    Oid reltablespace,
71                                                    bool shared_relation);
72
73 /*
74  * Routines for flushing/rebuilding relcache entries in various scenarios
75  */
76 extern void RelationForgetRelation(Oid rid);
77
78 extern void RelationCacheInvalidateEntry(Oid relationId);
79
80 extern void RelationCacheInvalidate(void);
81
82 extern void AtEOXact_RelationCache(bool isCommit);
83 extern void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid,
84                                                   SubTransactionId parentSubid);
85
86 extern void RelationCacheMarkNewRelfilenode(Relation rel);
87
88 /*
89  * Routines to help manage rebuilding of relcache init files
90  */
91 extern bool RelationIdIsInInitFile(Oid relationId);
92 extern void RelationCacheInitFileInvalidate(bool beforeSend);
93 extern void RelationCacheInitFileRemove(void);
94
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;
99
100 #endif   /* RELCACHE_H */