]> granicus.if.org Git - postgresql/blob - src/include/catalog/indexing.h
Add new CREATE CONVERSION/DROP CONVERSION command.
[postgresql] / src / include / catalog / indexing.h
1 /*-------------------------------------------------------------------------
2  *
3  * indexing.h
4  *        This file provides some definitions to support indexing
5  *        on system catalogs
6  *
7  *
8  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
9  * Portions Copyright (c) 1994, Regents of the University of California
10  *
11  * $Id: indexing.h,v 1.68 2002/07/11 07:39:27 ishii Exp $
12  *
13  *-------------------------------------------------------------------------
14  */
15 #ifndef INDEXING_H
16 #define INDEXING_H
17
18 #include "access/htup.h"
19
20 /*
21  * Number of indices that exist for each system catalog
22  */
23 #define Num_pg_aggregate_indices        1
24 #define Num_pg_am_indices                       2
25 #define Num_pg_amop_indices                     2
26 #define Num_pg_amproc_indices           1
27 #define Num_pg_attr_indices                     2
28 #define Num_pg_attrdef_indices          1
29 #define Num_pg_class_indices            2
30 #define Num_pg_conversion_indices       2
31 #define Num_pg_database_indices         2
32 #define Num_pg_description_indices      1
33 #define Num_pg_group_indices            2
34 #define Num_pg_index_indices            2
35 #define Num_pg_inherits_indices         1
36 #define Num_pg_language_indices         2
37 #define Num_pg_largeobject_indices      1
38 #define Num_pg_namespace_indices        2
39 #define Num_pg_opclass_indices          2
40 #define Num_pg_operator_indices         2
41 #define Num_pg_proc_indices                     2
42 #define Num_pg_relcheck_indices         1
43 #define Num_pg_rewrite_indices          2
44 #define Num_pg_shadow_indices           2
45 #define Num_pg_statistic_indices        1
46 #define Num_pg_trigger_indices          4
47 #define Num_pg_type_indices                     2
48
49 /*
50  * Names of indices on system catalogs
51  */
52 #define AccessMethodOperatorIndex       "pg_amop_opc_opr_index"
53 #define AccessMethodStrategyIndex       "pg_amop_opc_strategy_index"
54 #define AccessMethodProcedureIndex      "pg_amproc_opc_procnum_index"
55 #define AggregateFnoidIndex                     "pg_aggregate_fnoid_index"
56 #define AmNameIndex                                     "pg_am_name_index"
57 #define AmOidIndex                                      "pg_am_oid_index"
58 #define AttrDefaultIndex                        "pg_attrdef_adrelid_adnum_index"
59 #define AttributeRelidNameIndex         "pg_attribute_relid_attnam_index"
60 #define AttributeRelidNumIndex          "pg_attribute_relid_attnum_index"
61 #define ClassNameNspIndex                       "pg_class_relname_nsp_index"
62 #define ClassOidIndex                           "pg_class_oid_index"
63 #define ConversionDefaultIndex          "pg_conversion_default_index"
64 #define ConversionNameNspIndex          "pg_conversion_name_nsp_index"
65 #define DatabaseNameIndex                       "pg_database_datname_index"
66 #define DatabaseOidIndex                        "pg_database_oid_index"
67 #define DescriptionObjIndex                     "pg_description_o_c_o_index"
68 #define GroupNameIndex                          "pg_group_name_index"
69 #define GroupSysidIndex                         "pg_group_sysid_index"
70 #define IndexIndrelidIndex                      "pg_index_indrelid_index"
71 #define IndexRelidIndex                         "pg_index_indexrelid_index"
72 #define InheritsRelidSeqnoIndex         "pg_inherits_relid_seqno_index"
73 #define LanguageNameIndex                       "pg_language_name_index"
74 #define LanguageOidIndex                        "pg_language_oid_index"
75 #define LargeObjectLOidPNIndex          "pg_largeobject_loid_pn_index"
76 #define NamespaceNameIndex                      "pg_namespace_nspname_index"
77 #define NamespaceOidIndex                       "pg_namespace_oid_index"
78 #define OpclassAmNameNspIndex           "pg_opclass_am_name_nsp_index"
79 #define OpclassOidIndex                         "pg_opclass_oid_index"
80 #define OperatorNameNspIndex            "pg_operator_oprname_l_r_n_index"
81 #define OperatorOidIndex                        "pg_operator_oid_index"
82 #define ProcedureNameNspIndex           "pg_proc_proname_args_nsp_index"
83 #define ProcedureOidIndex                       "pg_proc_oid_index"
84 #define RelCheckIndex                           "pg_relcheck_rcrelid_index"
85 #define RewriteOidIndex                         "pg_rewrite_oid_index"
86 #define RewriteRelRulenameIndex         "pg_rewrite_rel_rulename_index"
87 #define ShadowNameIndex                         "pg_shadow_usename_index"
88 #define ShadowSysidIndex                        "pg_shadow_usesysid_index"
89 #define StatisticRelidAttnumIndex       "pg_statistic_relid_att_index"
90 #define TriggerConstrNameIndex          "pg_trigger_tgconstrname_index"
91 #define TriggerConstrRelidIndex         "pg_trigger_tgconstrrelid_index"
92 #define TriggerRelidNameIndex           "pg_trigger_tgrelid_tgname_index"
93 #define TriggerOidIndex                         "pg_trigger_oid_index"
94 #define TypeNameNspIndex                        "pg_type_typname_nsp_index"
95 #define TypeOidIndex                            "pg_type_oid_index"
96
97 /* Arrays of names of indices for each system catalog */
98 extern char *Name_pg_aggregate_indices[];
99 extern char *Name_pg_am_indices[];
100 extern char *Name_pg_amop_indices[];
101 extern char *Name_pg_amproc_indices[];
102 extern char *Name_pg_attr_indices[];
103 extern char *Name_pg_attrdef_indices[];
104 extern char *Name_pg_class_indices[];
105 extern char *Name_pg_conversion_indices[];
106 extern char *Name_pg_database_indices[];
107 extern char *Name_pg_description_indices[];
108 extern char *Name_pg_group_indices[];
109 extern char *Name_pg_index_indices[];
110 extern char *Name_pg_inherits_indices[];
111 extern char *Name_pg_language_indices[];
112 extern char *Name_pg_largeobject_indices[];
113 extern char *Name_pg_namespace_indices[];
114 extern char *Name_pg_opclass_indices[];
115 extern char *Name_pg_operator_indices[];
116 extern char *Name_pg_proc_indices[];
117 extern char *Name_pg_relcheck_indices[];
118 extern char *Name_pg_rewrite_indices[];
119 extern char *Name_pg_shadow_indices[];
120 extern char *Name_pg_statistic_indices[];
121 extern char *Name_pg_trigger_indices[];
122 extern char *Name_pg_type_indices[];
123
124
125 /*
126  * indexing.c prototypes
127  */
128 extern void CatalogOpenIndices(int nIndices, char **names, Relation *idescs);
129 extern void CatalogCloseIndices(int nIndices, Relation *idescs);
130 extern void CatalogIndexInsert(Relation *idescs, int nIndices,
131                                    Relation heapRelation, HeapTuple heapTuple);
132
133
134 /*
135  * These macros are just to keep the C compiler from spitting up on the
136  * upcoming commands for genbki.sh.
137  */
138 #define DECLARE_INDEX(x) extern int errno
139 #define DECLARE_UNIQUE_INDEX(x) extern int errno
140 #define BUILD_INDICES
141
142
143 /*
144  * What follows are lines processed by genbki.sh to create the statements
145  * the bootstrap parser will turn into DefineIndex commands.
146  *
147  * The keyword is DECLARE_INDEX or DECLARE_UNIQUE_INDEX.  Everything after
148  * that is just like in a normal 'create index' SQL command.
149  */
150
151 DECLARE_UNIQUE_INDEX(pg_aggregate_fnoid_index on pg_aggregate using btree(aggfnoid oid_ops));
152 DECLARE_UNIQUE_INDEX(pg_am_name_index on pg_am using btree(amname name_ops));
153 DECLARE_UNIQUE_INDEX(pg_am_oid_index on pg_am using btree(oid oid_ops));
154 DECLARE_UNIQUE_INDEX(pg_amop_opc_opr_index on pg_amop using btree(amopclaid oid_ops, amopopr oid_ops));
155 DECLARE_UNIQUE_INDEX(pg_amop_opc_strategy_index on pg_amop using btree(amopclaid oid_ops, amopstrategy int2_ops));
156 DECLARE_UNIQUE_INDEX(pg_amproc_opc_procnum_index on pg_amproc using btree(amopclaid oid_ops, amprocnum int2_ops));
157 DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index on pg_attrdef using btree(adrelid oid_ops, adnum int2_ops));
158 DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index on pg_attribute using btree(attrelid oid_ops, attname name_ops));
159 DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnum_index on pg_attribute using btree(attrelid oid_ops, attnum int2_ops));
160 DECLARE_UNIQUE_INDEX(pg_class_oid_index on pg_class using btree(oid oid_ops));
161 DECLARE_UNIQUE_INDEX(pg_class_relname_nsp_index on pg_class using btree(relname name_ops, relnamespace oid_ops));
162 /* This following index is not used for a cache and is not unique */
163 DECLARE_INDEX(pg_conversion_default_index on pg_conversion using btree(connamespace oid_ops, conforencoding int4_ops, contoencoding int4_ops));
164 DECLARE_UNIQUE_INDEX(pg_conversion_name_nsp_index on pg_conversion using btree(conname name_ops, connamespace oid_ops));
165 DECLARE_UNIQUE_INDEX(pg_database_datname_index on pg_database using btree(datname name_ops));
166 DECLARE_UNIQUE_INDEX(pg_database_oid_index on pg_database using btree(oid oid_ops));
167 DECLARE_UNIQUE_INDEX(pg_description_o_c_o_index on pg_description using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops));
168 DECLARE_UNIQUE_INDEX(pg_group_name_index on pg_group using btree(groname name_ops));
169 DECLARE_UNIQUE_INDEX(pg_group_sysid_index on pg_group using btree(grosysid int4_ops));
170 /* This following index is not used for a cache and is not unique */
171 DECLARE_INDEX(pg_index_indrelid_index on pg_index using btree(indrelid oid_ops));
172 DECLARE_UNIQUE_INDEX(pg_index_indexrelid_index on pg_index using btree(indexrelid oid_ops));
173 DECLARE_UNIQUE_INDEX(pg_inherits_relid_seqno_index on pg_inherits using btree(inhrelid oid_ops, inhseqno int4_ops));
174 DECLARE_UNIQUE_INDEX(pg_language_name_index on pg_language using btree(lanname name_ops));
175 DECLARE_UNIQUE_INDEX(pg_language_oid_index on pg_language using btree(oid oid_ops));
176 DECLARE_UNIQUE_INDEX(pg_largeobject_loid_pn_index on pg_largeobject using btree(loid oid_ops, pageno int4_ops));
177 DECLARE_UNIQUE_INDEX(pg_namespace_nspname_index on pg_namespace using btree(nspname name_ops));
178 DECLARE_UNIQUE_INDEX(pg_namespace_oid_index on pg_namespace using btree(oid oid_ops));
179 DECLARE_UNIQUE_INDEX(pg_opclass_am_name_nsp_index on pg_opclass using btree(opcamid oid_ops, opcname name_ops, opcnamespace oid_ops));
180 DECLARE_UNIQUE_INDEX(pg_opclass_oid_index on pg_opclass using btree(oid oid_ops));
181 DECLARE_UNIQUE_INDEX(pg_operator_oid_index on pg_operator using btree(oid oid_ops));
182 DECLARE_UNIQUE_INDEX(pg_operator_oprname_l_r_n_index on pg_operator using btree(oprname name_ops, oprleft oid_ops, oprright oid_ops, oprnamespace oid_ops));
183 DECLARE_UNIQUE_INDEX(pg_proc_oid_index on pg_proc using btree(oid oid_ops));
184 DECLARE_UNIQUE_INDEX(pg_proc_proname_args_nsp_index on pg_proc using btree(proname name_ops, pronargs int2_ops, proargtypes oidvector_ops, pronamespace oid_ops));
185 /* This following index is not used for a cache and is not unique */
186 DECLARE_INDEX(pg_relcheck_rcrelid_index on pg_relcheck using btree(rcrelid oid_ops));
187 DECLARE_UNIQUE_INDEX(pg_rewrite_oid_index on pg_rewrite using btree(oid oid_ops));
188 DECLARE_UNIQUE_INDEX(pg_rewrite_rel_rulename_index on pg_rewrite using btree(ev_class oid_ops, rulename name_ops));
189 DECLARE_UNIQUE_INDEX(pg_shadow_usename_index on pg_shadow using btree(usename name_ops));
190 DECLARE_UNIQUE_INDEX(pg_shadow_usesysid_index on pg_shadow using btree(usesysid int4_ops));
191 DECLARE_UNIQUE_INDEX(pg_statistic_relid_att_index on pg_statistic using btree(starelid oid_ops, staattnum int2_ops));
192 /* This following index is not used for a cache and is not unique */
193 DECLARE_INDEX(pg_trigger_tgconstrname_index on pg_trigger using btree(tgconstrname name_ops));
194 /* This following index is not used for a cache and is not unique */
195 DECLARE_INDEX(pg_trigger_tgconstrrelid_index on pg_trigger using btree(tgconstrrelid oid_ops));
196 DECLARE_UNIQUE_INDEX(pg_trigger_tgrelid_tgname_index on pg_trigger using btree(tgrelid oid_ops, tgname name_ops));
197 DECLARE_UNIQUE_INDEX(pg_trigger_oid_index on pg_trigger using btree(oid oid_ops));
198 DECLARE_UNIQUE_INDEX(pg_type_oid_index on pg_type using btree(oid oid_ops));
199 DECLARE_UNIQUE_INDEX(pg_type_typname_nsp_index on pg_type using btree(typname name_ops, typnamespace oid_ops));
200
201 /* last step of initialization script: build the indices declared above */
202 BUILD_INDICES
203
204 #endif   /* INDEXING_H */