Core support for "extensions", which are packages of SQL objects.
[pgsql.git] / src / include / catalog / indexing.h
blob4118e64542430ee47788d30fb2914baf41910583
1 /*-------------------------------------------------------------------------
3 * indexing.h
4 * This file provides some definitions to support indexing
5 * on system catalogs
8 * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
9 * Portions Copyright (c) 1994, Regents of the University of California
11 * src/include/catalog/indexing.h
13 *-------------------------------------------------------------------------
15 #ifndef INDEXING_H
16 #define INDEXING_H
18 #include "access/htup.h"
19 #include "utils/relcache.h"
22 * The state object used by CatalogOpenIndexes and friends is actually the
23 * same as the executor's ResultRelInfo, but we give it another type name
24 * to decouple callers from that fact.
26 typedef struct ResultRelInfo *CatalogIndexState;
29 * indexing.c prototypes
31 extern CatalogIndexState CatalogOpenIndexes(Relation heapRel);
32 extern void CatalogCloseIndexes(CatalogIndexState indstate);
33 extern void CatalogIndexInsert(CatalogIndexState indstate,
34 HeapTuple heapTuple);
35 extern void CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple);
39 * These macros are just to keep the C compiler from spitting up on the
40 * upcoming commands for genbki.pl.
42 #define DECLARE_INDEX(name,oid,decl) extern int no_such_variable
43 #define DECLARE_UNIQUE_INDEX(name,oid,decl) extern int no_such_variable
44 #define BUILD_INDICES
48 * What follows are lines processed by genbki.pl to create the statements
49 * the bootstrap parser will turn into DefineIndex commands.
51 * The keyword is DECLARE_INDEX or DECLARE_UNIQUE_INDEX. The first two
52 * arguments are the index name and OID, the rest is much like a standard
53 * 'create index' SQL command.
55 * For each index, we also provide a #define for its OID. References to
56 * the index in the C code should always use these #defines, not the actual
57 * index name (much less the numeric OID).
60 DECLARE_UNIQUE_INDEX(pg_aggregate_fnoid_index, 2650, on pg_aggregate using btree(aggfnoid oid_ops));
61 #define AggregateFnoidIndexId 2650
63 DECLARE_UNIQUE_INDEX(pg_am_name_index, 2651, on pg_am using btree(amname name_ops));
64 #define AmNameIndexId 2651
65 DECLARE_UNIQUE_INDEX(pg_am_oid_index, 2652, on pg_am using btree(oid oid_ops));
66 #define AmOidIndexId 2652
68 DECLARE_UNIQUE_INDEX(pg_amop_fam_strat_index, 2653, on pg_amop using btree(amopfamily oid_ops, amoplefttype oid_ops, amoprighttype oid_ops, amopstrategy int2_ops));
69 #define AccessMethodStrategyIndexId 2653
70 DECLARE_UNIQUE_INDEX(pg_amop_opr_fam_index, 2654, on pg_amop using btree(amopopr oid_ops, amoppurpose char_ops, amopfamily oid_ops));
71 #define AccessMethodOperatorIndexId 2654
72 DECLARE_UNIQUE_INDEX(pg_amop_oid_index, 2756, on pg_amop using btree(oid oid_ops));
73 #define AccessMethodOperatorOidIndexId 2756
75 DECLARE_UNIQUE_INDEX(pg_amproc_fam_proc_index, 2655, on pg_amproc using btree(amprocfamily oid_ops, amproclefttype oid_ops, amprocrighttype oid_ops, amprocnum int2_ops));
76 #define AccessMethodProcedureIndexId 2655
77 DECLARE_UNIQUE_INDEX(pg_amproc_oid_index, 2757, on pg_amproc using btree(oid oid_ops));
78 #define AccessMethodProcedureOidIndexId 2757
80 DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index, 2656, on pg_attrdef using btree(adrelid oid_ops, adnum int2_ops));
81 #define AttrDefaultIndexId 2656
82 DECLARE_UNIQUE_INDEX(pg_attrdef_oid_index, 2657, on pg_attrdef using btree(oid oid_ops));
83 #define AttrDefaultOidIndexId 2657
85 DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index, 2658, on pg_attribute using btree(attrelid oid_ops, attname name_ops));
86 #define AttributeRelidNameIndexId 2658
87 DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnum_index, 2659, on pg_attribute using btree(attrelid oid_ops, attnum int2_ops));
88 #define AttributeRelidNumIndexId 2659
90 DECLARE_UNIQUE_INDEX(pg_authid_rolname_index, 2676, on pg_authid using btree(rolname name_ops));
91 #define AuthIdRolnameIndexId 2676
92 DECLARE_UNIQUE_INDEX(pg_authid_oid_index, 2677, on pg_authid using btree(oid oid_ops));
93 #define AuthIdOidIndexId 2677
95 DECLARE_UNIQUE_INDEX(pg_auth_members_role_member_index, 2694, on pg_auth_members using btree(roleid oid_ops, member oid_ops));
96 #define AuthMemRoleMemIndexId 2694
97 DECLARE_UNIQUE_INDEX(pg_auth_members_member_role_index, 2695, on pg_auth_members using btree(member oid_ops, roleid oid_ops));
98 #define AuthMemMemRoleIndexId 2695
100 DECLARE_UNIQUE_INDEX(pg_cast_oid_index, 2660, on pg_cast using btree(oid oid_ops));
101 #define CastOidIndexId 2660
102 DECLARE_UNIQUE_INDEX(pg_cast_source_target_index, 2661, on pg_cast using btree(castsource oid_ops, casttarget oid_ops));
103 #define CastSourceTargetIndexId 2661
105 DECLARE_UNIQUE_INDEX(pg_class_oid_index, 2662, on pg_class using btree(oid oid_ops));
106 #define ClassOidIndexId 2662
107 DECLARE_UNIQUE_INDEX(pg_class_relname_nsp_index, 2663, on pg_class using btree(relname name_ops, relnamespace oid_ops));
108 #define ClassNameNspIndexId 2663
110 DECLARE_UNIQUE_INDEX(pg_collation_name_enc_nsp_index, 3164, on pg_collation using btree(collname name_ops, collencoding int4_ops, collnamespace oid_ops));
111 #define CollationNameEncNspIndexId 3164
112 DECLARE_UNIQUE_INDEX(pg_collation_oid_index, 3085, on pg_collation using btree(oid oid_ops));
113 #define CollationOidIndexId 3085
115 /* This following index is not used for a cache and is not unique */
116 DECLARE_INDEX(pg_constraint_conname_nsp_index, 2664, on pg_constraint using btree(conname name_ops, connamespace oid_ops));
117 #define ConstraintNameNspIndexId 2664
118 /* This following index is not used for a cache and is not unique */
119 DECLARE_INDEX(pg_constraint_conrelid_index, 2665, on pg_constraint using btree(conrelid oid_ops));
120 #define ConstraintRelidIndexId 2665
121 /* This following index is not used for a cache and is not unique */
122 DECLARE_INDEX(pg_constraint_contypid_index, 2666, on pg_constraint using btree(contypid oid_ops));
123 #define ConstraintTypidIndexId 2666
124 DECLARE_UNIQUE_INDEX(pg_constraint_oid_index, 2667, on pg_constraint using btree(oid oid_ops));
125 #define ConstraintOidIndexId 2667
127 DECLARE_UNIQUE_INDEX(pg_conversion_default_index, 2668, on pg_conversion using btree(connamespace oid_ops, conforencoding int4_ops, contoencoding int4_ops, oid oid_ops));
128 #define ConversionDefaultIndexId 2668
129 DECLARE_UNIQUE_INDEX(pg_conversion_name_nsp_index, 2669, on pg_conversion using btree(conname name_ops, connamespace oid_ops));
130 #define ConversionNameNspIndexId 2669
131 DECLARE_UNIQUE_INDEX(pg_conversion_oid_index, 2670, on pg_conversion using btree(oid oid_ops));
132 #define ConversionOidIndexId 2670
134 DECLARE_UNIQUE_INDEX(pg_database_datname_index, 2671, on pg_database using btree(datname name_ops));
135 #define DatabaseNameIndexId 2671
136 DECLARE_UNIQUE_INDEX(pg_database_oid_index, 2672, on pg_database using btree(oid oid_ops));
137 #define DatabaseOidIndexId 2672
139 /* This following index is not used for a cache and is not unique */
140 DECLARE_INDEX(pg_depend_depender_index, 2673, on pg_depend using btree(classid oid_ops, objid oid_ops, objsubid int4_ops));
141 #define DependDependerIndexId 2673
142 /* This following index is not used for a cache and is not unique */
143 DECLARE_INDEX(pg_depend_reference_index, 2674, on pg_depend using btree(refclassid oid_ops, refobjid oid_ops, refobjsubid int4_ops));
144 #define DependReferenceIndexId 2674
146 DECLARE_UNIQUE_INDEX(pg_description_o_c_o_index, 2675, on pg_description using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops));
147 #define DescriptionObjIndexId 2675
148 DECLARE_UNIQUE_INDEX(pg_shdescription_o_c_index, 2397, on pg_shdescription using btree(objoid oid_ops, classoid oid_ops));
149 #define SharedDescriptionObjIndexId 2397
151 DECLARE_UNIQUE_INDEX(pg_enum_oid_index, 3502, on pg_enum using btree(oid oid_ops));
152 #define EnumOidIndexId 3502
153 DECLARE_UNIQUE_INDEX(pg_enum_typid_label_index, 3503, on pg_enum using btree(enumtypid oid_ops, enumlabel name_ops));
154 #define EnumTypIdLabelIndexId 3503
155 DECLARE_UNIQUE_INDEX(pg_enum_typid_sortorder_index, 3534, on pg_enum using btree(enumtypid oid_ops, enumsortorder float4_ops));
156 #define EnumTypIdSortOrderIndexId 3534
158 /* This following index is not used for a cache and is not unique */
159 DECLARE_INDEX(pg_index_indrelid_index, 2678, on pg_index using btree(indrelid oid_ops));
160 #define IndexIndrelidIndexId 2678
161 DECLARE_UNIQUE_INDEX(pg_index_indexrelid_index, 2679, on pg_index using btree(indexrelid oid_ops));
162 #define IndexRelidIndexId 2679
164 DECLARE_UNIQUE_INDEX(pg_inherits_relid_seqno_index, 2680, on pg_inherits using btree(inhrelid oid_ops, inhseqno int4_ops));
165 #define InheritsRelidSeqnoIndexId 2680
166 /* This following index is not used for a cache and is not unique */
167 DECLARE_INDEX(pg_inherits_parent_index, 2187, on pg_inherits using btree(inhparent oid_ops));
168 #define InheritsParentIndexId 2187
170 DECLARE_UNIQUE_INDEX(pg_language_name_index, 2681, on pg_language using btree(lanname name_ops));
171 #define LanguageNameIndexId 2681
172 DECLARE_UNIQUE_INDEX(pg_language_oid_index, 2682, on pg_language using btree(oid oid_ops));
173 #define LanguageOidIndexId 2682
175 DECLARE_UNIQUE_INDEX(pg_largeobject_loid_pn_index, 2683, on pg_largeobject using btree(loid oid_ops, pageno int4_ops));
176 #define LargeObjectLOidPNIndexId 2683
178 DECLARE_UNIQUE_INDEX(pg_largeobject_metadata_oid_index, 2996, on pg_largeobject_metadata using btree(oid oid_ops));
179 #define LargeObjectMetadataOidIndexId 2996
181 DECLARE_UNIQUE_INDEX(pg_namespace_nspname_index, 2684, on pg_namespace using btree(nspname name_ops));
182 #define NamespaceNameIndexId 2684
183 DECLARE_UNIQUE_INDEX(pg_namespace_oid_index, 2685, on pg_namespace using btree(oid oid_ops));
184 #define NamespaceOidIndexId 2685
186 DECLARE_UNIQUE_INDEX(pg_opclass_am_name_nsp_index, 2686, on pg_opclass using btree(opcmethod oid_ops, opcname name_ops, opcnamespace oid_ops));
187 #define OpclassAmNameNspIndexId 2686
188 DECLARE_UNIQUE_INDEX(pg_opclass_oid_index, 2687, on pg_opclass using btree(oid oid_ops));
189 #define OpclassOidIndexId 2687
191 DECLARE_UNIQUE_INDEX(pg_operator_oid_index, 2688, on pg_operator using btree(oid oid_ops));
192 #define OperatorOidIndexId 2688
193 DECLARE_UNIQUE_INDEX(pg_operator_oprname_l_r_n_index, 2689, on pg_operator using btree(oprname name_ops, oprleft oid_ops, oprright oid_ops, oprnamespace oid_ops));
194 #define OperatorNameNspIndexId 2689
196 DECLARE_UNIQUE_INDEX(pg_opfamily_am_name_nsp_index, 2754, on pg_opfamily using btree(opfmethod oid_ops, opfname name_ops, opfnamespace oid_ops));
197 #define OpfamilyAmNameNspIndexId 2754
198 DECLARE_UNIQUE_INDEX(pg_opfamily_oid_index, 2755, on pg_opfamily using btree(oid oid_ops));
199 #define OpfamilyOidIndexId 2755
201 DECLARE_UNIQUE_INDEX(pg_pltemplate_name_index, 1137, on pg_pltemplate using btree(tmplname name_ops));
202 #define PLTemplateNameIndexId 1137
204 DECLARE_UNIQUE_INDEX(pg_proc_oid_index, 2690, on pg_proc using btree(oid oid_ops));
205 #define ProcedureOidIndexId 2690
206 DECLARE_UNIQUE_INDEX(pg_proc_proname_args_nsp_index, 2691, on pg_proc using btree(proname name_ops, proargtypes oidvector_ops, pronamespace oid_ops));
207 #define ProcedureNameArgsNspIndexId 2691
209 DECLARE_UNIQUE_INDEX(pg_rewrite_oid_index, 2692, on pg_rewrite using btree(oid oid_ops));
210 #define RewriteOidIndexId 2692
211 DECLARE_UNIQUE_INDEX(pg_rewrite_rel_rulename_index, 2693, on pg_rewrite using btree(ev_class oid_ops, rulename name_ops));
212 #define RewriteRelRulenameIndexId 2693
214 /* This following index is not used for a cache and is not unique */
215 DECLARE_INDEX(pg_shdepend_depender_index, 1232, on pg_shdepend using btree(dbid oid_ops, classid oid_ops, objid oid_ops, objsubid int4_ops));
216 #define SharedDependDependerIndexId 1232
217 /* This following index is not used for a cache and is not unique */
218 DECLARE_INDEX(pg_shdepend_reference_index, 1233, on pg_shdepend using btree(refclassid oid_ops, refobjid oid_ops));
219 #define SharedDependReferenceIndexId 1233
221 DECLARE_UNIQUE_INDEX(pg_statistic_relid_att_inh_index, 2696, on pg_statistic using btree(starelid oid_ops, staattnum int2_ops, stainherit bool_ops));
222 #define StatisticRelidAttnumInhIndexId 2696
224 DECLARE_UNIQUE_INDEX(pg_tablespace_oid_index, 2697, on pg_tablespace using btree(oid oid_ops));
225 #define TablespaceOidIndexId 2697
226 DECLARE_UNIQUE_INDEX(pg_tablespace_spcname_index, 2698, on pg_tablespace using btree(spcname name_ops));
227 #define TablespaceNameIndexId 2698
229 /* This following index is not used for a cache and is not unique */
230 DECLARE_INDEX(pg_trigger_tgconstraint_index, 2699, on pg_trigger using btree(tgconstraint oid_ops));
231 #define TriggerConstraintIndexId 2699
232 DECLARE_UNIQUE_INDEX(pg_trigger_tgrelid_tgname_index, 2701, on pg_trigger using btree(tgrelid oid_ops, tgname name_ops));
233 #define TriggerRelidNameIndexId 2701
234 DECLARE_UNIQUE_INDEX(pg_trigger_oid_index, 2702, on pg_trigger using btree(oid oid_ops));
235 #define TriggerOidIndexId 2702
237 DECLARE_UNIQUE_INDEX(pg_ts_config_cfgname_index, 3608, on pg_ts_config using btree(cfgname name_ops, cfgnamespace oid_ops));
238 #define TSConfigNameNspIndexId 3608
239 DECLARE_UNIQUE_INDEX(pg_ts_config_oid_index, 3712, on pg_ts_config using btree(oid oid_ops));
240 #define TSConfigOidIndexId 3712
242 DECLARE_UNIQUE_INDEX(pg_ts_config_map_index, 3609, on pg_ts_config_map using btree(mapcfg oid_ops, maptokentype int4_ops, mapseqno int4_ops));
243 #define TSConfigMapIndexId 3609
245 DECLARE_UNIQUE_INDEX(pg_ts_dict_dictname_index, 3604, on pg_ts_dict using btree(dictname name_ops, dictnamespace oid_ops));
246 #define TSDictionaryNameNspIndexId 3604
247 DECLARE_UNIQUE_INDEX(pg_ts_dict_oid_index, 3605, on pg_ts_dict using btree(oid oid_ops));
248 #define TSDictionaryOidIndexId 3605
250 DECLARE_UNIQUE_INDEX(pg_ts_parser_prsname_index, 3606, on pg_ts_parser using btree(prsname name_ops, prsnamespace oid_ops));
251 #define TSParserNameNspIndexId 3606
252 DECLARE_UNIQUE_INDEX(pg_ts_parser_oid_index, 3607, on pg_ts_parser using btree(oid oid_ops));
253 #define TSParserOidIndexId 3607
255 DECLARE_UNIQUE_INDEX(pg_ts_template_tmplname_index, 3766, on pg_ts_template using btree(tmplname name_ops, tmplnamespace oid_ops));
256 #define TSTemplateNameNspIndexId 3766
257 DECLARE_UNIQUE_INDEX(pg_ts_template_oid_index, 3767, on pg_ts_template using btree(oid oid_ops));
258 #define TSTemplateOidIndexId 3767
260 DECLARE_UNIQUE_INDEX(pg_type_oid_index, 2703, on pg_type using btree(oid oid_ops));
261 #define TypeOidIndexId 2703
262 DECLARE_UNIQUE_INDEX(pg_type_typname_nsp_index, 2704, on pg_type using btree(typname name_ops, typnamespace oid_ops));
263 #define TypeNameNspIndexId 2704
265 DECLARE_UNIQUE_INDEX(pg_foreign_data_wrapper_oid_index, 112, on pg_foreign_data_wrapper using btree(oid oid_ops));
266 #define ForeignDataWrapperOidIndexId 112
268 DECLARE_UNIQUE_INDEX(pg_foreign_data_wrapper_name_index, 548, on pg_foreign_data_wrapper using btree(fdwname name_ops));
269 #define ForeignDataWrapperNameIndexId 548
271 DECLARE_UNIQUE_INDEX(pg_foreign_server_oid_index, 113, on pg_foreign_server using btree(oid oid_ops));
272 #define ForeignServerOidIndexId 113
274 DECLARE_UNIQUE_INDEX(pg_foreign_server_name_index, 549, on pg_foreign_server using btree(srvname name_ops));
275 #define ForeignServerNameIndexId 549
277 DECLARE_UNIQUE_INDEX(pg_user_mapping_oid_index, 174, on pg_user_mapping using btree(oid oid_ops));
278 #define UserMappingOidIndexId 174
280 DECLARE_UNIQUE_INDEX(pg_user_mapping_user_server_index, 175, on pg_user_mapping using btree(umuser oid_ops, umserver oid_ops));
281 #define UserMappingUserServerIndexId 175
283 DECLARE_UNIQUE_INDEX(pg_foreign_table_relid_index, 3119, on pg_foreign_table using btree(ftrelid oid_ops));
284 #define ForeignTableRelidIndexId 3119
286 DECLARE_UNIQUE_INDEX(pg_default_acl_role_nsp_obj_index, 827, on pg_default_acl using btree(defaclrole oid_ops, defaclnamespace oid_ops, defaclobjtype char_ops));
287 #define DefaultAclRoleNspObjIndexId 827
288 DECLARE_UNIQUE_INDEX(pg_default_acl_oid_index, 828, on pg_default_acl using btree(oid oid_ops));
289 #define DefaultAclOidIndexId 828
291 DECLARE_UNIQUE_INDEX(pg_db_role_setting_databaseid_rol_index, 2965, on pg_db_role_setting using btree(setdatabase oid_ops, setrole oid_ops));
292 #define DbRoleSettingDatidRolidIndexId 2965
294 DECLARE_UNIQUE_INDEX(pg_seclabel_object_index, 3597, on pg_seclabel using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops, provider text_ops));
295 #define SecLabelObjectIndexId 3597
297 DECLARE_UNIQUE_INDEX(pg_extension_oid_index, 3080, on pg_extension using btree(oid oid_ops));
298 #define ExtensionOidIndexId 3080
300 DECLARE_UNIQUE_INDEX(pg_extension_name_index, 3081, on pg_extension using btree(extname name_ops));
301 #define ExtensionNameIndexId 3081
303 /* last step of initialization script: build the indexes declared above */
304 BUILD_INDICES
306 #endif /* INDEXING_H */