1 /*-------------------------------------------------------------------------
4 * This include provides some definitions to support indexing
8 * Copyright (c) 1994, Regents of the University of California
10 * $Id: indexing.h,v 1.24 1999/09/29 16:06:14 wieck Exp $
12 *-------------------------------------------------------------------------
17 #include "access/htup.h"
20 * Some definitions for indices on pg_attribute
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
33 * Names of indices on system catalogs
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"
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[];
61 extern char *IndexedCatalogNames[];
64 * indexing.c prototypes
66 * Functions for each index to perform the necessary scan on a cache miss.
68 extern void CatalogOpenIndices(int nIndices, char **names, Relation *idescs);
69 extern void CatalogCloseIndices(int nIndices, Relation *idescs);
70 extern void CatalogIndexInsert(Relation *idescs,
72 Relation heapRelation,
74 extern bool CatalogHasIndex(char *catName, Oid catId);
76 extern HeapTuple AttributeNameIndexScan(Relation heapRelation,
80 extern HeapTuple AttributeNumIndexScan(Relation heapRelation,
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);
94 * What follows are lines processed by genbki.sh to create the statements
95 * the bootstrap parser will turn into DefineIndex commands.
97 * The keyword is DECLARE_INDEX every thing after that is just like in a
98 * normal specification of the 'define index' POSTQUEL command.
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));
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));
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));
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));
114 DECLARE_INDEX(pg_attrdef_adrelid_index on pg_attrdef using btree(adrelid oid_ops));
116 DECLARE_INDEX(pg_relcheck_rcrelid_index on pg_relcheck using btree(rcrelid oid_ops));
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));
122 DECLARE_INDEX(pg_description_objoid_index on pg_description using btree(objoid oid_ops));
124 /* now build indices in the initialization scripts */
127 #endif /* INDEXING_H */