]> granicus.if.org Git - postgresql/blob - src/include/catalog/indexing.h
39bc8193da2f14e12a2416ecbb952a2f1755020d
[postgresql] / src / include / catalog / indexing.h
1 /*-------------------------------------------------------------------------
2  *
3  * indexing.h
4  *        This include provides some definitions to support indexing
5  *        on system catalogs
6  *
7  *
8  * Copyright (c) 1994, Regents of the University of California
9  *
10  * $Id: indexing.h,v 1.24 1999/09/29 16:06:14 wieck Exp $
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef INDEXING_H
15 #define INDEXING_H
16
17 #include "access/htup.h"
18
19 /*
20  * Some definitions for indices on pg_attribute
21  */
22 #define Num_pg_attr_indices             3
23 #define Num_pg_proc_indices             3
24 #define Num_pg_type_indices             2
25 #define Num_pg_class_indices    2
26 #define Num_pg_attrdef_indices  1
27 #define Num_pg_relcheck_indices 1
28 #define Num_pg_trigger_indices  3
29 #define Num_pg_description_indices      1
30
31
32 /*
33  * Names of indices on system catalogs
34  */
35 #define AttributeNameIndex              "pg_attribute_relid_attnam_index"
36 #define AttributeNumIndex               "pg_attribute_relid_attnum_index"
37 #define AttributeRelidIndex             "pg_attribute_attrelid_index"
38 #define ProcedureOidIndex               "pg_proc_oid_index"
39 #define ProcedureNameIndex              "pg_proc_proname_narg_type_index"
40 #define ProcedureSrcIndex               "pg_proc_prosrc_index"
41 #define TypeOidIndex                    "pg_type_oid_index"
42 #define TypeNameIndex                   "pg_type_typname_index"
43 #define ClassOidIndex                   "pg_class_oid_index"
44 #define ClassNameIndex                  "pg_class_relname_index"
45 #define AttrDefaultIndex                "pg_attrdef_adrelid_index"
46 #define RelCheckIndex                   "pg_relcheck_rcrelid_index"
47 #define TriggerRelidIndex               "pg_trigger_tgrelid_index"
48 #define TriggerConstrNameIndex  "pg_trigger_tgconstrname_index"
49 #define TriggerConstrRelidIndex "pg_trigger_tgconstrrelid_index"
50 #define DescriptionObjIndex             "pg_description_objoid_index"
51
52 extern char *Name_pg_attr_indices[];
53 extern char *Name_pg_proc_indices[];
54 extern char *Name_pg_type_indices[];
55 extern char *Name_pg_class_indices[];
56 extern char *Name_pg_attrdef_indices[];
57 extern char *Name_pg_relcheck_indices[];
58 extern char *Name_pg_trigger_indices[];
59 extern char *Name_pg_description_indices[];
60
61 extern char *IndexedCatalogNames[];
62
63 /*
64  * indexing.c prototypes
65  *
66  * Functions for each index to perform the necessary scan on a cache miss.
67  */
68 extern void CatalogOpenIndices(int nIndices, char **names, Relation *idescs);
69 extern void CatalogCloseIndices(int nIndices, Relation *idescs);
70 extern void CatalogIndexInsert(Relation *idescs,
71                                    int nIndices,
72                                    Relation heapRelation,
73                                    HeapTuple heapTuple);
74 extern bool CatalogHasIndex(char *catName, Oid catId);
75
76 extern HeapTuple AttributeNameIndexScan(Relation heapRelation,
77                                            Oid relid,
78                                            char *attname);
79
80 extern HeapTuple AttributeNumIndexScan(Relation heapRelation,
81                                           Oid relid,
82                                           AttrNumber attnum);
83 extern HeapTuple ProcedureOidIndexScan(Relation heapRelation, Oid procId);
84 extern HeapTuple ProcedureNameIndexScan(Relation heapRelation,
85                                            char *procName, int2 nargs, Oid *argTypes);
86 extern HeapTuple ProcedureSrcIndexScan(Relation heapRelation, text *procSrc);
87 extern HeapTuple TypeOidIndexScan(Relation heapRelation, Oid typeId);
88 extern HeapTuple TypeNameIndexScan(Relation heapRelation, char *typeName);
89 extern HeapTuple ClassNameIndexScan(Relation heapRelation, char *relName);
90 extern HeapTuple ClassOidIndexScan(Relation heapRelation, Oid relId);
91
92
93 /*
94  * What follows are lines processed by genbki.sh to create the statements
95  * the bootstrap parser will turn into DefineIndex commands.
96  *
97  * The keyword is DECLARE_INDEX every thing after that is just like in a
98  * normal specification of the 'define index' POSTQUEL command.
99  */
100 DECLARE_INDEX(pg_attribute_relid_attnam_index on pg_attribute using btree(attrelid oid_ops, attname name_ops));
101 DECLARE_INDEX(pg_attribute_relid_attnum_index on pg_attribute using btree(attrelid oid_ops, attnum int2_ops));
102 DECLARE_INDEX(pg_attribute_attrelid_index on pg_attribute using btree(attrelid oid_ops));
103
104 DECLARE_INDEX(pg_proc_oid_index on pg_proc using btree(oid oid_ops));
105 DECLARE_INDEX(pg_proc_proname_narg_type_index on pg_proc using btree(proname name_ops, pronargs int2_ops, proargtypes oid8_ops));
106 DECLARE_INDEX(pg_proc_prosrc_index on pg_proc using btree(prosrc text_ops));
107
108 DECLARE_INDEX(pg_type_oid_index on pg_type using btree(oid oid_ops));
109 DECLARE_INDEX(pg_type_typname_index on pg_type using btree(typname name_ops));
110
111 DECLARE_INDEX(pg_class_oid_index on pg_class using btree(oid oid_ops));
112 DECLARE_INDEX(pg_class_relname_index on pg_class using btree(relname name_ops));
113
114 DECLARE_INDEX(pg_attrdef_adrelid_index on pg_attrdef using btree(adrelid oid_ops));
115
116 DECLARE_INDEX(pg_relcheck_rcrelid_index on pg_relcheck using btree(rcrelid oid_ops));
117
118 DECLARE_INDEX(pg_trigger_tgrelid_index on pg_trigger using btree(tgrelid oid_ops));
119 DECLARE_INDEX(pg_trigger_tgconstrname_index on pg_trigger using btree(tgconstrname name_ops));
120 DECLARE_INDEX(pg_trigger_tgconstrrelid_index on pg_trigger using btree(tgconstrrelid oid_ops));
121
122 DECLARE_INDEX(pg_description_objoid_index on pg_description using btree(objoid oid_ops));
123
124 /* now build indices in the initialization scripts */
125 BUILD_INDICES
126
127 #endif   /* INDEXING_H */