]> granicus.if.org Git - postgresql/blob - src/include/catalog/indexing.h
Reverse out cache changes that are not ready yet.
[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.23 1999/07/20 17:14:07 momjian 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  1
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 DescriptionObjIndex "pg_description_objoid_index"
49
50 extern char *Name_pg_attr_indices[];
51 extern char *Name_pg_proc_indices[];
52 extern char *Name_pg_type_indices[];
53 extern char *Name_pg_class_indices[];
54 extern char *Name_pg_attrdef_indices[];
55 extern char *Name_pg_relcheck_indices[];
56 extern char *Name_pg_trigger_indices[];
57 extern char *Name_pg_description_indices[];
58
59 extern char *IndexedCatalogNames[];
60
61 /*
62  * indexing.c prototypes
63  *
64  * Functions for each index to perform the necessary scan on a cache miss.
65  */
66 extern void CatalogOpenIndices(int nIndices, char **names, Relation *idescs);
67 extern void CatalogCloseIndices(int nIndices, Relation *idescs);
68 extern void CatalogIndexInsert(Relation *idescs,
69                                    int nIndices,
70                                    Relation heapRelation,
71                                    HeapTuple heapTuple);
72 extern bool CatalogHasIndex(char *catName, Oid catId);
73
74 extern HeapTuple AttributeNameIndexScan(Relation heapRelation,
75                                            Oid relid,
76                                            char *attname);
77
78 extern HeapTuple AttributeNumIndexScan(Relation heapRelation,
79                                           Oid relid,
80                                           AttrNumber attnum);
81 extern HeapTuple ProcedureOidIndexScan(Relation heapRelation, Oid procId);
82 extern HeapTuple ProcedureNameIndexScan(Relation heapRelation,
83                                            char *procName, int2 nargs, Oid *argTypes);
84 extern HeapTuple ProcedureSrcIndexScan(Relation heapRelation, text *procSrc);
85 extern HeapTuple TypeOidIndexScan(Relation heapRelation, Oid typeId);
86 extern HeapTuple TypeNameIndexScan(Relation heapRelation, char *typeName);
87 extern HeapTuple ClassNameIndexScan(Relation heapRelation, char *relName);
88 extern HeapTuple ClassOidIndexScan(Relation heapRelation, Oid relId);
89
90
91 /*
92  * What follows are lines processed by genbki.sh to create the statements
93  * the bootstrap parser will turn into DefineIndex commands.
94  *
95  * The keyword is DECLARE_INDEX every thing after that is just like in a
96  * normal specification of the 'define index' POSTQUEL command.
97  */
98 DECLARE_INDEX(pg_attribute_relid_attnam_index on pg_attribute using btree(attrelid oid_ops, attname name_ops));
99 DECLARE_INDEX(pg_attribute_relid_attnum_index on pg_attribute using btree(attrelid oid_ops, attnum int2_ops));
100 DECLARE_INDEX(pg_attribute_attrelid_index on pg_attribute using btree(attrelid oid_ops));
101
102 DECLARE_INDEX(pg_proc_oid_index on pg_proc using btree(oid oid_ops));
103 DECLARE_INDEX(pg_proc_proname_narg_type_index on pg_proc using btree(proname name_ops, pronargs int2_ops, proargtypes oid8_ops));
104 DECLARE_INDEX(pg_proc_prosrc_index on pg_proc using btree(prosrc text_ops));
105
106 DECLARE_INDEX(pg_type_oid_index on pg_type using btree(oid oid_ops));
107 DECLARE_INDEX(pg_type_typname_index on pg_type using btree(typname name_ops));
108
109 DECLARE_INDEX(pg_class_oid_index on pg_class using btree(oid oid_ops));
110 DECLARE_INDEX(pg_class_relname_index on pg_class using btree(relname name_ops));
111
112 DECLARE_INDEX(pg_attrdef_adrelid_index on pg_attrdef using btree(adrelid oid_ops));
113
114 DECLARE_INDEX(pg_relcheck_rcrelid_index on pg_relcheck using btree(rcrelid oid_ops));
115
116 DECLARE_INDEX(pg_trigger_tgrelid_index on pg_trigger using btree(tgrelid oid_ops));
117
118 DECLARE_INDEX(pg_description_objoid_index on pg_description using btree(objoid oid_ops));
119
120 /* now build indices in the initialization scripts */
121 BUILD_INDICES
122
123 #endif   /* INDEXING_H */