PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
index.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * index.h
4  * prototypes for catalog/index.c.
5  *
6  *
7  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/catalog/index.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef INDEX_H
15 #define INDEX_H
16 
17 #include "catalog/objectaddress.h"
18 #include "nodes/execnodes.h"
19 
20 
21 #define DEFAULT_INDEX_TYPE "btree"
22 
23 /* Typedef for callback function for IndexBuildHeapScan */
25  HeapTuple htup,
26  Datum *values,
27  bool *isnull,
28  bool tupleIsAlive,
29  void *state);
30 
31 /* Action code for index_set_state_flags */
32 typedef enum
33 {
39 
40 
41 extern void index_check_primary_key(Relation heapRel,
42  IndexInfo *indexInfo,
43  bool is_alter_table);
44 
45 extern Oid index_create(Relation heapRelation,
46  const char *indexRelationName,
47  Oid indexRelationId,
48  Oid relFileNode,
49  IndexInfo *indexInfo,
50  List *indexColNames,
51  Oid accessMethodObjectId,
52  Oid tableSpaceId,
53  Oid *collationObjectId,
54  Oid *classObjectId,
55  int16 *coloptions,
56  Datum reloptions,
57  bool isprimary,
58  bool isconstraint,
59  bool deferrable,
60  bool initdeferred,
61  bool allow_system_table_mods,
62  bool skip_build,
63  bool concurrent,
64  bool is_internal,
65  bool if_not_exists);
66 
68  Oid indexRelationId,
69  IndexInfo *indexInfo,
70  const char *constraintName,
71  char constraintType,
72  bool deferrable,
73  bool initdeferred,
74  bool mark_as_primary,
75  bool update_pgindex,
76  bool remove_old_dependencies,
77  bool allow_system_table_mods,
78  bool is_internal);
79 
80 extern void index_drop(Oid indexId, bool concurrent);
81 
83 
85 
86 extern void FormIndexDatum(IndexInfo *indexInfo,
87  TupleTableSlot *slot,
88  EState *estate,
89  Datum *values,
90  bool *isnull);
91 
92 extern void index_build(Relation heapRelation,
93  Relation indexRelation,
94  IndexInfo *indexInfo,
95  bool isprimary,
96  bool isreindex);
97 
98 extern double IndexBuildHeapScan(Relation heapRelation,
99  Relation indexRelation,
100  IndexInfo *indexInfo,
101  bool allow_sync,
103  void *callback_state);
104 extern double IndexBuildHeapRangeScan(Relation heapRelation,
105  Relation indexRelation,
106  IndexInfo *indexInfo,
107  bool allow_sync,
108  bool anyvisible,
109  BlockNumber start_blockno,
110  BlockNumber end_blockno,
112  void *callback_state);
113 
114 extern void validate_index(Oid heapId, Oid indexId, Snapshot snapshot);
115 
116 extern void index_set_state_flags(Oid indexId, IndexStateFlagsAction action);
117 
118 extern void reindex_index(Oid indexId, bool skip_constraint_checks,
119  char relpersistence, int options);
120 
121 /* Flag bits for reindex_relation(): */
122 #define REINDEX_REL_PROCESS_TOAST 0x01
123 #define REINDEX_REL_SUPPRESS_INDEX_USE 0x02
124 #define REINDEX_REL_CHECK_CONSTRAINTS 0x04
125 #define REINDEX_REL_FORCE_INDEXES_UNLOGGED 0x08
126 #define REINDEX_REL_FORCE_INDEXES_PERMANENT 0x10
127 
128 extern bool reindex_relation(Oid relid, int flags, int options);
129 
130 extern bool ReindexIsProcessingHeap(Oid heapOid);
131 extern bool ReindexIsProcessingIndex(Oid indexOid);
132 extern Oid IndexGetRelation(Oid indexId, bool missing_ok);
133 
134 #endif /* INDEX_H */
signed short int16
Definition: c.h:252
double IndexBuildHeapScan(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo, bool allow_sync, IndexBuildCallback callback, void *callback_state)
Definition: index.c:2169
void reindex_index(Oid indexId, bool skip_constraint_checks, char relpersistence, int options)
Definition: index.c:3306
void index_check_primary_key(Relation heapRel, IndexInfo *indexInfo, bool is_alter_table)
Definition: index.c:192
void(* IndexBuildCallback)(Relation index, HeapTuple htup, Datum *values, bool *isnull, bool tupleIsAlive, void *state)
Definition: index.h:24
uint32 BlockNumber
Definition: block.h:31
unsigned int Oid
Definition: postgres_ext.h:31
bool ReindexIsProcessingHeap(Oid heapOid)
Definition: index.c:3666
ObjectAddress index_constraint_create(Relation heapRelation, Oid indexRelationId, IndexInfo *indexInfo, const char *constraintName, char constraintType, bool deferrable, bool initdeferred, bool mark_as_primary, bool update_pgindex, bool remove_old_dependencies, bool allow_system_table_mods, bool is_internal)
Definition: index.c:1147
bool ReindexIsProcessingIndex(Oid indexOid)
Definition: index.c:3687
Definition: type.h:90
Oid index_create(Relation heapRelation, const char *indexRelationName, Oid indexRelationId, Oid relFileNode, IndexInfo *indexInfo, List *indexColNames, Oid accessMethodObjectId, Oid tableSpaceId, Oid *collationObjectId, Oid *classObjectId, int16 *coloptions, Datum reloptions, bool isprimary, bool isconstraint, bool deferrable, bool initdeferred, bool allow_system_table_mods, bool skip_build, bool concurrent, bool is_internal, bool if_not_exists)
Definition: index.c:697
void validate_index(Oid heapId, Oid indexId, Snapshot snapshot)
Definition: index.c:2803
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:49
IndexInfo * BuildIndexInfo(Relation index)
Definition: index.c:1639
IndexStateFlagsAction
Definition: index.h:32
uintptr_t Datum
Definition: postgres.h:374
double IndexBuildHeapRangeScan(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo, bool allow_sync, bool anyvisible, BlockNumber start_blockno, BlockNumber end_blockno, IndexBuildCallback callback, void *callback_state)
Definition: index.c:2194
void index_build(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo, bool isprimary, bool isreindex)
Definition: index.c:2000
Definition: regguts.h:298
Oid IndexGetRelation(Oid indexId, bool missing_ok)
Definition: index.c:3281
void index_drop(Oid indexId, bool concurrent)
Definition: index.c:1344
static Datum values[MAXATTR]
Definition: bootstrap.c:162
void FormIndexDatum(IndexInfo *indexInfo, TupleTableSlot *slot, EState *estate, Datum *values, bool *isnull)
Definition: index.c:1764
bool reindex_relation(Oid relid, int flags, int options)
Definition: index.c:3515
Definition: pg_list.h:45
void BuildSpeculativeIndexInfo(Relation index, IndexInfo *ii)
Definition: index.c:1710
void index_set_state_flags(Oid indexId, IndexStateFlagsAction action)
Definition: index.c:3202