Header And Logo

PostgreSQL
| The world's most advanced open source database.

index.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * index.h
00004  *    prototypes for catalog/index.c.
00005  *
00006  *
00007  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00008  * Portions Copyright (c) 1994, Regents of the University of California
00009  *
00010  * src/include/catalog/index.h
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef INDEX_H
00015 #define INDEX_H
00016 
00017 #include "nodes/execnodes.h"
00018 
00019 
00020 #define DEFAULT_INDEX_TYPE  "btree"
00021 
00022 /* Typedef for callback function for IndexBuildHeapScan */
00023 typedef void (*IndexBuildCallback) (Relation index,
00024                                                 HeapTuple htup,
00025                                                 Datum *values,
00026                                                 bool *isnull,
00027                                                 bool tupleIsAlive,
00028                                                 void *state);
00029 
00030 /* Action code for index_set_state_flags */
00031 typedef enum
00032 {
00033     INDEX_CREATE_SET_READY,
00034     INDEX_CREATE_SET_VALID,
00035     INDEX_DROP_CLEAR_VALID,
00036     INDEX_DROP_SET_DEAD
00037 } IndexStateFlagsAction;
00038 
00039 
00040 extern void index_check_primary_key(Relation heapRel,
00041                         IndexInfo *indexInfo,
00042                         bool is_alter_table);
00043 
00044 extern Oid index_create(Relation heapRelation,
00045              const char *indexRelationName,
00046              Oid indexRelationId,
00047              Oid relFileNode,
00048              IndexInfo *indexInfo,
00049              List *indexColNames,
00050              Oid accessMethodObjectId,
00051              Oid tableSpaceId,
00052              Oid *collationObjectId,
00053              Oid *classObjectId,
00054              int16 *coloptions,
00055              Datum reloptions,
00056              bool isprimary,
00057              bool isconstraint,
00058              bool deferrable,
00059              bool initdeferred,
00060              bool allow_system_table_mods,
00061              bool skip_build,
00062              bool concurrent,
00063              bool is_internal);
00064 
00065 extern void index_constraint_create(Relation heapRelation,
00066                         Oid indexRelationId,
00067                         IndexInfo *indexInfo,
00068                         const char *constraintName,
00069                         char constraintType,
00070                         bool deferrable,
00071                         bool initdeferred,
00072                         bool mark_as_primary,
00073                         bool update_pgindex,
00074                         bool remove_old_dependencies,
00075                         bool allow_system_table_mods,
00076                         bool is_internal);
00077 
00078 extern void index_drop(Oid indexId, bool concurrent);
00079 
00080 extern IndexInfo *BuildIndexInfo(Relation index);
00081 
00082 extern void FormIndexDatum(IndexInfo *indexInfo,
00083                TupleTableSlot *slot,
00084                EState *estate,
00085                Datum *values,
00086                bool *isnull);
00087 
00088 extern void index_build(Relation heapRelation,
00089             Relation indexRelation,
00090             IndexInfo *indexInfo,
00091             bool isprimary,
00092             bool isreindex);
00093 
00094 extern double IndexBuildHeapScan(Relation heapRelation,
00095                    Relation indexRelation,
00096                    IndexInfo *indexInfo,
00097                    bool allow_sync,
00098                    IndexBuildCallback callback,
00099                    void *callback_state);
00100 
00101 extern void validate_index(Oid heapId, Oid indexId, Snapshot snapshot);
00102 
00103 extern void index_set_state_flags(Oid indexId, IndexStateFlagsAction action);
00104 
00105 extern void reindex_index(Oid indexId, bool skip_constraint_checks);
00106 
00107 /* Flag bits for reindex_relation(): */
00108 #define REINDEX_REL_PROCESS_TOAST       0x01
00109 #define REINDEX_REL_SUPPRESS_INDEX_USE  0x02
00110 #define REINDEX_REL_CHECK_CONSTRAINTS   0x04
00111 
00112 extern bool reindex_relation(Oid relid, int flags);
00113 
00114 extern bool ReindexIsProcessingHeap(Oid heapOid);
00115 extern bool ReindexIsProcessingIndex(Oid indexOid);
00116 extern Oid  IndexGetRelation(Oid indexId, bool missing_ok);
00117 
00118 #endif   /* INDEX_H */