]> granicus.if.org Git - postgresql/blob - src/include/catalog/index.h
Avoid index rebuild for no-rewrite ALTER TABLE .. ALTER TYPE.
[postgresql] / src / include / catalog / index.h
1 /*-------------------------------------------------------------------------
2  *
3  * index.h
4  *        prototypes for catalog/index.c.
5  *
6  *
7  * Portions Copyright (c) 1996-2011, 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 "nodes/execnodes.h"
18
19
20 #define DEFAULT_INDEX_TYPE      "btree"
21
22 /* Typedef for callback function for IndexBuildHeapScan */
23 typedef void (*IndexBuildCallback) (Relation index,
24                                                                                                 HeapTuple htup,
25                                                                                                 Datum *values,
26                                                                                                 bool *isnull,
27                                                                                                 bool tupleIsAlive,
28                                                                                                 void *state);
29
30
31 extern void index_check_primary_key(Relation heapRel,
32                                                 IndexInfo *indexInfo,
33                                                 bool is_alter_table);
34
35 extern Oid index_create(Relation heapRelation,
36                          const char *indexRelationName,
37                          Oid indexRelationId,
38                          Oid relFileNode,
39                          IndexInfo *indexInfo,
40                          List *indexColNames,
41                          Oid accessMethodObjectId,
42                          Oid tableSpaceId,
43                          Oid *collationObjectId,
44                          Oid *classObjectId,
45                          int16 *coloptions,
46                          Datum reloptions,
47                          bool isprimary,
48                          bool isconstraint,
49                          bool deferrable,
50                          bool initdeferred,
51                          bool allow_system_table_mods,
52                          bool skip_build,
53                          bool concurrent);
54
55 extern void index_constraint_create(Relation heapRelation,
56                                                 Oid indexRelationId,
57                                                 IndexInfo *indexInfo,
58                                                 const char *constraintName,
59                                                 char constraintType,
60                                                 bool deferrable,
61                                                 bool initdeferred,
62                                                 bool mark_as_primary,
63                                                 bool update_pgindex,
64                                                 bool allow_system_table_mods);
65
66 extern void index_drop(Oid indexId);
67
68 extern IndexInfo *BuildIndexInfo(Relation index);
69
70 extern void FormIndexDatum(IndexInfo *indexInfo,
71                            TupleTableSlot *slot,
72                            EState *estate,
73                            Datum *values,
74                            bool *isnull);
75
76 extern void index_build(Relation heapRelation,
77                         Relation indexRelation,
78                         IndexInfo *indexInfo,
79                         bool isprimary,
80                         bool isreindex);
81
82 extern double IndexBuildHeapScan(Relation heapRelation,
83                                    Relation indexRelation,
84                                    IndexInfo *indexInfo,
85                                    bool allow_sync,
86                                    IndexBuildCallback callback,
87                                    void *callback_state);
88
89 extern void validate_index(Oid heapId, Oid indexId, Snapshot snapshot);
90
91 extern void reindex_index(Oid indexId, bool skip_constraint_checks);
92
93 /* Flag bits for reindex_relation(): */
94 #define REINDEX_REL_PROCESS_TOAST               0x01
95 #define REINDEX_REL_SUPPRESS_INDEX_USE  0x02
96 #define REINDEX_REL_CHECK_CONSTRAINTS   0x04
97
98 extern bool reindex_relation(Oid relid, int flags);
99
100 extern bool ReindexIsProcessingHeap(Oid heapOid);
101 extern bool ReindexIsProcessingIndex(Oid indexOid);
102
103 #endif   /* INDEX_H */