]> granicus.if.org Git - postgresql/blob - src/include/catalog/indexing.h
Update copyright to 2004.
[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-2004, PostgreSQL Global Development Group
9  * Portions Copyright (c) 1994, Regents of the University of California
10  *
11  * $PostgreSQL: pgsql/src/include/catalog/indexing.h,v 1.83 2004/08/29 04:13:05 momjian Exp $
12  *
13  *-------------------------------------------------------------------------
14  */
15 #ifndef INDEXING_H
16 #define INDEXING_H
17
18 #include "access/htup.h"
19
20 /*
21  * Names of indexes on system catalogs
22  *
23  * References to specific system indexes in the C code should use these
24  * macros rather than hardwiring the actual index name.
25  */
26 #define AccessMethodOperatorIndex       "pg_amop_opr_opc_index"
27 #define AccessMethodStrategyIndex       "pg_amop_opc_strat_index"
28 #define AccessMethodProcedureIndex      "pg_amproc_opc_proc_index"
29 #define AggregateFnoidIndex                     "pg_aggregate_fnoid_index"
30 #define AmNameIndex                                     "pg_am_name_index"
31 #define AmOidIndex                                      "pg_am_oid_index"
32 #define AttrDefaultIndex                        "pg_attrdef_adrelid_adnum_index"
33 #define AttrDefaultOidIndex                     "pg_attrdef_oid_index"
34 #define AttributeRelidNameIndex         "pg_attribute_relid_attnam_index"
35 #define AttributeRelidNumIndex          "pg_attribute_relid_attnum_index"
36 #define CastOidIndex                            "pg_cast_oid_index"
37 #define CastSourceTargetIndex           "pg_cast_source_target_index"
38 #define ClassNameNspIndex                       "pg_class_relname_nsp_index"
39 #define ClassOidIndex                           "pg_class_oid_index"
40 #define ConstraintNameNspIndex          "pg_constraint_conname_nsp_index"
41 #define ConstraintOidIndex                      "pg_constraint_oid_index"
42 #define ConstraintRelidIndex            "pg_constraint_conrelid_index"
43 #define ConstraintTypidIndex            "pg_constraint_contypid_index"
44 #define ConversionDefaultIndex          "pg_conversion_default_index"
45 #define ConversionNameNspIndex          "pg_conversion_name_nsp_index"
46 #define ConversionOidIndex                      "pg_conversion_oid_index"
47 #define DatabaseNameIndex                       "pg_database_datname_index"
48 #define DatabaseOidIndex                        "pg_database_oid_index"
49 #define DependDependerIndex                     "pg_depend_depender_index"
50 #define DependReferenceIndex            "pg_depend_reference_index"
51 #define DescriptionObjIndex                     "pg_description_o_c_o_index"
52 #define GroupNameIndex                          "pg_group_name_index"
53 #define GroupSysidIndex                         "pg_group_sysid_index"
54 #define IndexIndrelidIndex                      "pg_index_indrelid_index"
55 #define IndexRelidIndex                         "pg_index_indexrelid_index"
56 #define InheritsRelidSeqnoIndex         "pg_inherits_relid_seqno_index"
57 #define LanguageNameIndex                       "pg_language_name_index"
58 #define LanguageOidIndex                        "pg_language_oid_index"
59 #define LargeObjectLOidPNIndex          "pg_largeobject_loid_pn_index"
60 #define NamespaceNameIndex                      "pg_namespace_nspname_index"
61 #define NamespaceOidIndex                       "pg_namespace_oid_index"
62 #define OpclassAmNameNspIndex           "pg_opclass_am_name_nsp_index"
63 #define OpclassOidIndex                         "pg_opclass_oid_index"
64 #define OperatorNameNspIndex            "pg_operator_oprname_l_r_n_index"
65 #define OperatorOidIndex                        "pg_operator_oid_index"
66 #define ProcedureNameNspIndex           "pg_proc_proname_args_nsp_index"
67 #define ProcedureOidIndex                       "pg_proc_oid_index"
68 #define RewriteOidIndex                         "pg_rewrite_oid_index"
69 #define RewriteRelRulenameIndex         "pg_rewrite_rel_rulename_index"
70 #define ShadowNameIndex                         "pg_shadow_usename_index"
71 #define ShadowSysidIndex                        "pg_shadow_usesysid_index"
72 #define StatisticRelidAttnumIndex       "pg_statistic_relid_att_index"
73 #define TablespaceNameIndex                     "pg_tablespace_spcname_index"
74 #define TablespaceOidIndex                      "pg_tablespace_oid_index"
75 #define TriggerConstrNameIndex          "pg_trigger_tgconstrname_index"
76 #define TriggerConstrRelidIndex         "pg_trigger_tgconstrrelid_index"
77 #define TriggerRelidNameIndex           "pg_trigger_tgrelid_tgname_index"
78 #define TriggerOidIndex                         "pg_trigger_oid_index"
79 #define TypeNameNspIndex                        "pg_type_typname_nsp_index"
80 #define TypeOidIndex                            "pg_type_oid_index"
81
82
83 /*
84  * The state object used by CatalogOpenIndexes and friends is actually the
85  * same as the executor's ResultRelInfo, but we give it another type name
86  * to decouple callers from that fact.
87  */
88 typedef struct ResultRelInfo *CatalogIndexState;
89
90 /*
91  * indexing.c prototypes
92  */
93 extern CatalogIndexState CatalogOpenIndexes(Relation heapRel);
94 extern void CatalogCloseIndexes(CatalogIndexState indstate);
95 extern void CatalogIndexInsert(CatalogIndexState indstate,
96                                    HeapTuple heapTuple);
97 extern void CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple);
98
99
100 /*
101  * These macros are just to keep the C compiler from spitting up on the
102  * upcoming commands for genbki.sh.
103  */
104 #define DECLARE_INDEX(x) extern int no_such_variable
105 #define DECLARE_UNIQUE_INDEX(x) extern int no_such_variable
106 #define BUILD_INDICES
107
108
109 /*
110  * What follows are lines processed by genbki.sh to create the statements
111  * the bootstrap parser will turn into DefineIndex commands.
112  *
113  * The keyword is DECLARE_INDEX or DECLARE_UNIQUE_INDEX.  Everything after
114  * that is just like in a normal 'create index' SQL command.
115  */
116
117 DECLARE_UNIQUE_INDEX(pg_aggregate_fnoid_index on pg_aggregate using btree(aggfnoid oid_ops));
118 DECLARE_UNIQUE_INDEX(pg_am_name_index on pg_am using btree(amname name_ops));
119 DECLARE_UNIQUE_INDEX(pg_am_oid_index on pg_am using btree(oid oid_ops));
120 DECLARE_UNIQUE_INDEX(pg_amop_opc_strat_index on pg_amop using btree(amopclaid oid_ops, amopsubtype oid_ops, amopstrategy int2_ops));
121 DECLARE_UNIQUE_INDEX(pg_amop_opr_opc_index on pg_amop using btree(amopopr oid_ops, amopclaid oid_ops));
122 DECLARE_UNIQUE_INDEX(pg_amproc_opc_proc_index on pg_amproc using btree(amopclaid oid_ops, amprocsubtype oid_ops, amprocnum int2_ops));
123 DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index on pg_attrdef using btree(adrelid oid_ops, adnum int2_ops));
124 DECLARE_UNIQUE_INDEX(pg_attrdef_oid_index on pg_attrdef using btree(oid oid_ops));
125 DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index on pg_attribute using btree(attrelid oid_ops, attname name_ops));
126 DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnum_index on pg_attribute using btree(attrelid oid_ops, attnum int2_ops));
127 DECLARE_UNIQUE_INDEX(pg_cast_oid_index on pg_cast using btree(oid oid_ops));
128 DECLARE_UNIQUE_INDEX(pg_cast_source_target_index on pg_cast using btree(castsource oid_ops, casttarget oid_ops));
129 DECLARE_UNIQUE_INDEX(pg_class_oid_index on pg_class using btree(oid oid_ops));
130 DECLARE_UNIQUE_INDEX(pg_class_relname_nsp_index on pg_class using btree(relname name_ops, relnamespace oid_ops));
131 /* This following index is not used for a cache and is not unique */
132 DECLARE_INDEX(pg_constraint_conname_nsp_index on pg_constraint using btree(conname name_ops, connamespace oid_ops));
133 /* This following index is not used for a cache and is not unique */
134 DECLARE_INDEX(pg_constraint_conrelid_index on pg_constraint using btree(conrelid oid_ops));
135 /* This following index is not used for a cache and is not unique */
136 DECLARE_INDEX(pg_constraint_contypid_index on pg_constraint using btree(contypid oid_ops));
137 DECLARE_UNIQUE_INDEX(pg_constraint_oid_index on pg_constraint using btree(oid oid_ops));
138 DECLARE_UNIQUE_INDEX(pg_conversion_default_index on pg_conversion using btree(connamespace oid_ops, conforencoding int4_ops, contoencoding int4_ops, oid oid_ops));
139 DECLARE_UNIQUE_INDEX(pg_conversion_name_nsp_index on pg_conversion using btree(conname name_ops, connamespace oid_ops));
140 DECLARE_UNIQUE_INDEX(pg_conversion_oid_index on pg_conversion using btree(oid oid_ops));
141 DECLARE_UNIQUE_INDEX(pg_database_datname_index on pg_database using btree(datname name_ops));
142 DECLARE_UNIQUE_INDEX(pg_database_oid_index on pg_database using btree(oid oid_ops));
143 /* This following index is not used for a cache and is not unique */
144 DECLARE_INDEX(pg_depend_depender_index on pg_depend using btree(classid oid_ops, objid oid_ops, objsubid int4_ops));
145 /* This following index is not used for a cache and is not unique */
146 DECLARE_INDEX(pg_depend_reference_index on pg_depend using btree(refclassid oid_ops, refobjid oid_ops, refobjsubid int4_ops));
147 DECLARE_UNIQUE_INDEX(pg_description_o_c_o_index on pg_description using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops));
148 DECLARE_UNIQUE_INDEX(pg_group_name_index on pg_group using btree(groname name_ops));
149 DECLARE_UNIQUE_INDEX(pg_group_sysid_index on pg_group using btree(grosysid int4_ops));
150 /* This following index is not used for a cache and is not unique */
151 DECLARE_INDEX(pg_index_indrelid_index on pg_index using btree(indrelid oid_ops));
152 DECLARE_UNIQUE_INDEX(pg_index_indexrelid_index on pg_index using btree(indexrelid oid_ops));
153 DECLARE_UNIQUE_INDEX(pg_inherits_relid_seqno_index on pg_inherits using btree(inhrelid oid_ops, inhseqno int4_ops));
154 DECLARE_UNIQUE_INDEX(pg_language_name_index on pg_language using btree(lanname name_ops));
155 DECLARE_UNIQUE_INDEX(pg_language_oid_index on pg_language using btree(oid oid_ops));
156 DECLARE_UNIQUE_INDEX(pg_largeobject_loid_pn_index on pg_largeobject using btree(loid oid_ops, pageno int4_ops));
157 DECLARE_UNIQUE_INDEX(pg_namespace_nspname_index on pg_namespace using btree(nspname name_ops));
158 DECLARE_UNIQUE_INDEX(pg_namespace_oid_index on pg_namespace using btree(oid oid_ops));
159 DECLARE_UNIQUE_INDEX(pg_opclass_am_name_nsp_index on pg_opclass using btree(opcamid oid_ops, opcname name_ops, opcnamespace oid_ops));
160 DECLARE_UNIQUE_INDEX(pg_opclass_oid_index on pg_opclass using btree(oid oid_ops));
161 DECLARE_UNIQUE_INDEX(pg_operator_oid_index on pg_operator using btree(oid oid_ops));
162 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));
163 DECLARE_UNIQUE_INDEX(pg_proc_oid_index on pg_proc using btree(oid oid_ops));
164 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));
165 /* This following index is not used for a cache and is not unique */
166 DECLARE_UNIQUE_INDEX(pg_rewrite_oid_index on pg_rewrite using btree(oid oid_ops));
167 DECLARE_UNIQUE_INDEX(pg_rewrite_rel_rulename_index on pg_rewrite using btree(ev_class oid_ops, rulename name_ops));
168 DECLARE_UNIQUE_INDEX(pg_shadow_usename_index on pg_shadow using btree(usename name_ops));
169 DECLARE_UNIQUE_INDEX(pg_shadow_usesysid_index on pg_shadow using btree(usesysid int4_ops));
170 DECLARE_UNIQUE_INDEX(pg_statistic_relid_att_index on pg_statistic using btree(starelid oid_ops, staattnum int2_ops));
171 DECLARE_UNIQUE_INDEX(pg_tablespace_oid_index on pg_tablespace using btree(oid oid_ops));
172 DECLARE_UNIQUE_INDEX(pg_tablespace_spcname_index on pg_tablespace using btree(spcname name_ops));
173 /* This following index is not used for a cache and is not unique */
174 DECLARE_INDEX(pg_trigger_tgconstrname_index on pg_trigger using btree(tgconstrname name_ops));
175 /* This following index is not used for a cache and is not unique */
176 DECLARE_INDEX(pg_trigger_tgconstrrelid_index on pg_trigger using btree(tgconstrrelid oid_ops));
177 DECLARE_UNIQUE_INDEX(pg_trigger_tgrelid_tgname_index on pg_trigger using btree(tgrelid oid_ops, tgname name_ops));
178 DECLARE_UNIQUE_INDEX(pg_trigger_oid_index on pg_trigger using btree(oid oid_ops));
179 DECLARE_UNIQUE_INDEX(pg_type_oid_index on pg_type using btree(oid oid_ops));
180 DECLARE_UNIQUE_INDEX(pg_type_typname_nsp_index on pg_type using btree(typname name_ops, typnamespace oid_ops));
181
182 /* last step of initialization script: build the indexes declared above */
183 BUILD_INDICES
184
185 #endif   /* INDEXING_H */