1 /*-------------------------------------------------------------------------
4 * prototypes for catalog/index.c.
7 * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/catalog/index.h
12 *-------------------------------------------------------------------------
17 #include "catalog/objectaddress.h"
18 #include "nodes/execnodes.h"
21 #define DEFAULT_INDEX_TYPE "btree"
23 /* Typedef for callback function for IndexBuildHeapScan */
24 typedef void (*IndexBuildCallback) (Relation index,
31 /* Action code for index_set_state_flags */
34 INDEX_CREATE_SET_READY,
35 INDEX_CREATE_SET_VALID,
36 INDEX_DROP_CLEAR_VALID,
38 } IndexStateFlagsAction;
41 extern void index_check_primary_key(Relation heapRel,
45 extern Oid index_create(Relation heapRelation,
46 const char *indexRelationName,
51 Oid accessMethodObjectId,
53 Oid *collationObjectId,
61 bool allow_system_table_mods,
67 extern ObjectAddress index_constraint_create(Relation heapRelation,
70 const char *constraintName,
76 bool remove_old_dependencies,
77 bool allow_system_table_mods,
80 extern void index_drop(Oid indexId, bool concurrent);
82 extern IndexInfo *BuildIndexInfo(Relation index);
84 extern void FormIndexDatum(IndexInfo *indexInfo,
90 extern void index_build(Relation heapRelation,
91 Relation indexRelation,
96 extern double IndexBuildHeapScan(Relation heapRelation,
97 Relation indexRelation,
100 IndexBuildCallback callback,
101 void *callback_state);
102 extern double IndexBuildHeapRangeScan(Relation heapRelation,
103 Relation indexRelation,
104 IndexInfo *indexInfo,
106 BlockNumber start_blockno,
107 BlockNumber end_blockno,
108 IndexBuildCallback callback,
109 void *callback_state);
111 extern void validate_index(Oid heapId, Oid indexId, Snapshot snapshot);
113 extern void index_set_state_flags(Oid indexId, IndexStateFlagsAction action);
115 extern void reindex_index(Oid indexId, bool skip_constraint_checks,
116 char relpersistence);
118 /* Flag bits for reindex_relation(): */
119 #define REINDEX_REL_PROCESS_TOAST 0x01
120 #define REINDEX_REL_SUPPRESS_INDEX_USE 0x02
121 #define REINDEX_REL_CHECK_CONSTRAINTS 0x04
122 #define REINDEX_REL_FORCE_INDEXES_UNLOGGED 0x08
123 #define REINDEX_REL_FORCE_INDEXES_PERMANENT 0x10
125 extern bool reindex_relation(Oid relid, int flags);
127 extern bool ReindexIsProcessingHeap(Oid heapOid);
128 extern bool ReindexIsProcessingIndex(Oid indexOid);
129 extern Oid IndexGetRelation(Oid indexId, bool missing_ok);