Header And Logo

PostgreSQL
| The world's most advanced open source database.

indexing.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * indexing.h
00004  *    This file provides some definitions to support indexing
00005  *    on system catalogs
00006  *
00007  *
00008  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00009  * Portions Copyright (c) 1994, Regents of the University of California
00010  *
00011  * src/include/catalog/indexing.h
00012  *
00013  *-------------------------------------------------------------------------
00014  */
00015 #ifndef INDEXING_H
00016 #define INDEXING_H
00017 
00018 #include "access/htup.h"
00019 #include "utils/relcache.h"
00020 
00021 /*
00022  * The state object used by CatalogOpenIndexes and friends is actually the
00023  * same as the executor's ResultRelInfo, but we give it another type name
00024  * to decouple callers from that fact.
00025  */
00026 typedef struct ResultRelInfo *CatalogIndexState;
00027 
00028 /*
00029  * indexing.c prototypes
00030  */
00031 extern CatalogIndexState CatalogOpenIndexes(Relation heapRel);
00032 extern void CatalogCloseIndexes(CatalogIndexState indstate);
00033 extern void CatalogIndexInsert(CatalogIndexState indstate,
00034                    HeapTuple heapTuple);
00035 extern void CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple);
00036 
00037 
00038 /*
00039  * These macros are just to keep the C compiler from spitting up on the
00040  * upcoming commands for genbki.pl.
00041  */
00042 #define DECLARE_INDEX(name,oid,decl) extern int no_such_variable
00043 #define DECLARE_UNIQUE_INDEX(name,oid,decl) extern int no_such_variable
00044 #define BUILD_INDICES
00045 
00046 
00047 /*
00048  * What follows are lines processed by genbki.pl to create the statements
00049  * the bootstrap parser will turn into DefineIndex commands.
00050  *
00051  * The keyword is DECLARE_INDEX or DECLARE_UNIQUE_INDEX.  The first two
00052  * arguments are the index name and OID, the rest is much like a standard
00053  * 'create index' SQL command.
00054  *
00055  * For each index, we also provide a #define for its OID.  References to
00056  * the index in the C code should always use these #defines, not the actual
00057  * index name (much less the numeric OID).
00058  */
00059 
00060 DECLARE_UNIQUE_INDEX(pg_aggregate_fnoid_index, 2650, on pg_aggregate using btree(aggfnoid oid_ops));
00061 #define AggregateFnoidIndexId  2650
00062 
00063 DECLARE_UNIQUE_INDEX(pg_am_name_index, 2651, on pg_am using btree(amname name_ops));
00064 #define AmNameIndexId  2651
00065 DECLARE_UNIQUE_INDEX(pg_am_oid_index, 2652, on pg_am using btree(oid oid_ops));
00066 #define AmOidIndexId  2652
00067 
00068 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));
00069 #define AccessMethodStrategyIndexId  2653
00070 DECLARE_UNIQUE_INDEX(pg_amop_opr_fam_index, 2654, on pg_amop using btree(amopopr oid_ops, amoppurpose char_ops, amopfamily oid_ops));
00071 #define AccessMethodOperatorIndexId  2654
00072 DECLARE_UNIQUE_INDEX(pg_amop_oid_index, 2756, on pg_amop using btree(oid oid_ops));
00073 #define AccessMethodOperatorOidIndexId  2756
00074 
00075 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));
00076 #define AccessMethodProcedureIndexId  2655
00077 DECLARE_UNIQUE_INDEX(pg_amproc_oid_index, 2757, on pg_amproc using btree(oid oid_ops));
00078 #define AccessMethodProcedureOidIndexId  2757
00079 
00080 DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index, 2656, on pg_attrdef using btree(adrelid oid_ops, adnum int2_ops));
00081 #define AttrDefaultIndexId  2656
00082 DECLARE_UNIQUE_INDEX(pg_attrdef_oid_index, 2657, on pg_attrdef using btree(oid oid_ops));
00083 #define AttrDefaultOidIndexId  2657
00084 
00085 DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnam_index, 2658, on pg_attribute using btree(attrelid oid_ops, attname name_ops));
00086 #define AttributeRelidNameIndexId  2658
00087 DECLARE_UNIQUE_INDEX(pg_attribute_relid_attnum_index, 2659, on pg_attribute using btree(attrelid oid_ops, attnum int2_ops));
00088 #define AttributeRelidNumIndexId  2659
00089 
00090 DECLARE_UNIQUE_INDEX(pg_authid_rolname_index, 2676, on pg_authid using btree(rolname name_ops));
00091 #define AuthIdRolnameIndexId    2676
00092 DECLARE_UNIQUE_INDEX(pg_authid_oid_index, 2677, on pg_authid using btree(oid oid_ops));
00093 #define AuthIdOidIndexId    2677
00094 
00095 DECLARE_UNIQUE_INDEX(pg_auth_members_role_member_index, 2694, on pg_auth_members using btree(roleid oid_ops, member oid_ops));
00096 #define AuthMemRoleMemIndexId   2694
00097 DECLARE_UNIQUE_INDEX(pg_auth_members_member_role_index, 2695, on pg_auth_members using btree(member oid_ops, roleid oid_ops));
00098 #define AuthMemMemRoleIndexId   2695
00099 
00100 DECLARE_UNIQUE_INDEX(pg_cast_oid_index, 2660, on pg_cast using btree(oid oid_ops));
00101 #define CastOidIndexId  2660
00102 DECLARE_UNIQUE_INDEX(pg_cast_source_target_index, 2661, on pg_cast using btree(castsource oid_ops, casttarget oid_ops));
00103 #define CastSourceTargetIndexId  2661
00104 
00105 DECLARE_UNIQUE_INDEX(pg_class_oid_index, 2662, on pg_class using btree(oid oid_ops));
00106 #define ClassOidIndexId  2662
00107 DECLARE_UNIQUE_INDEX(pg_class_relname_nsp_index, 2663, on pg_class using btree(relname name_ops, relnamespace oid_ops));
00108 #define ClassNameNspIndexId  2663
00109 
00110 DECLARE_UNIQUE_INDEX(pg_collation_name_enc_nsp_index, 3164, on pg_collation using btree(collname name_ops, collencoding int4_ops, collnamespace oid_ops));
00111 #define CollationNameEncNspIndexId 3164
00112 DECLARE_UNIQUE_INDEX(pg_collation_oid_index, 3085, on pg_collation using btree(oid oid_ops));
00113 #define CollationOidIndexId  3085
00114 
00115 /* This following index is not used for a cache and is not unique */
00116 DECLARE_INDEX(pg_constraint_conname_nsp_index, 2664, on pg_constraint using btree(conname name_ops, connamespace oid_ops));
00117 #define ConstraintNameNspIndexId  2664
00118 /* This following index is not used for a cache and is not unique */
00119 DECLARE_INDEX(pg_constraint_conrelid_index, 2665, on pg_constraint using btree(conrelid oid_ops));
00120 #define ConstraintRelidIndexId  2665
00121 /* This following index is not used for a cache and is not unique */
00122 DECLARE_INDEX(pg_constraint_contypid_index, 2666, on pg_constraint using btree(contypid oid_ops));
00123 #define ConstraintTypidIndexId  2666
00124 DECLARE_UNIQUE_INDEX(pg_constraint_oid_index, 2667, on pg_constraint using btree(oid oid_ops));
00125 #define ConstraintOidIndexId  2667
00126 
00127 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));
00128 #define ConversionDefaultIndexId  2668
00129 DECLARE_UNIQUE_INDEX(pg_conversion_name_nsp_index, 2669, on pg_conversion using btree(conname name_ops, connamespace oid_ops));
00130 #define ConversionNameNspIndexId  2669
00131 DECLARE_UNIQUE_INDEX(pg_conversion_oid_index, 2670, on pg_conversion using btree(oid oid_ops));
00132 #define ConversionOidIndexId  2670
00133 
00134 DECLARE_UNIQUE_INDEX(pg_database_datname_index, 2671, on pg_database using btree(datname name_ops));
00135 #define DatabaseNameIndexId  2671
00136 DECLARE_UNIQUE_INDEX(pg_database_oid_index, 2672, on pg_database using btree(oid oid_ops));
00137 #define DatabaseOidIndexId  2672
00138 
00139 /* This following index is not used for a cache and is not unique */
00140 DECLARE_INDEX(pg_depend_depender_index, 2673, on pg_depend using btree(classid oid_ops, objid oid_ops, objsubid int4_ops));
00141 #define DependDependerIndexId  2673
00142 /* This following index is not used for a cache and is not unique */
00143 DECLARE_INDEX(pg_depend_reference_index, 2674, on pg_depend using btree(refclassid oid_ops, refobjid oid_ops, refobjsubid int4_ops));
00144 #define DependReferenceIndexId  2674
00145 
00146 DECLARE_UNIQUE_INDEX(pg_description_o_c_o_index, 2675, on pg_description using btree(objoid oid_ops, classoid oid_ops, objsubid int4_ops));
00147 #define DescriptionObjIndexId  2675
00148 DECLARE_UNIQUE_INDEX(pg_shdescription_o_c_index, 2397, on pg_shdescription using btree(objoid oid_ops, classoid oid_ops));
00149 #define SharedDescriptionObjIndexId 2397
00150 
00151 DECLARE_UNIQUE_INDEX(pg_enum_oid_index, 3502, on pg_enum using btree(oid oid_ops));
00152 #define EnumOidIndexId  3502
00153 DECLARE_UNIQUE_INDEX(pg_enum_typid_label_index, 3503, on pg_enum using btree(enumtypid oid_ops, enumlabel name_ops));
00154 #define EnumTypIdLabelIndexId 3503
00155 DECLARE_UNIQUE_INDEX(pg_enum_typid_sortorder_index, 3534, on pg_enum using btree(enumtypid oid_ops, enumsortorder float4_ops));
00156 #define EnumTypIdSortOrderIndexId 3534
00157 
00158 /* This following index is not used for a cache and is not unique */
00159 DECLARE_INDEX(pg_index_indrelid_index, 2678, on pg_index using btree(indrelid oid_ops));
00160 #define IndexIndrelidIndexId  2678
00161 DECLARE_UNIQUE_INDEX(pg_index_indexrelid_index, 2679, on pg_index using btree(indexrelid oid_ops));
00162 #define IndexRelidIndexId  2679
00163 
00164 DECLARE_UNIQUE_INDEX(pg_inherits_relid_seqno_index, 2680, on pg_inherits using btree(inhrelid oid_ops, inhseqno int4_ops));
00165 #define InheritsRelidSeqnoIndexId  2680
00166 /* This following index is not used for a cache and is not unique */
00167 DECLARE_INDEX(pg_inherits_parent_index, 2187, on pg_inherits using btree(inhparent oid_ops));
00168 #define InheritsParentIndexId  2187
00169 
00170 DECLARE_UNIQUE_INDEX(pg_language_name_index, 2681, on pg_language using btree(lanname name_ops));
00171 #define LanguageNameIndexId  2681
00172 DECLARE_UNIQUE_INDEX(pg_language_oid_index, 2682, on pg_language using btree(oid oid_ops));
00173 #define LanguageOidIndexId  2682
00174 
00175 DECLARE_UNIQUE_INDEX(pg_largeobject_loid_pn_index, 2683, on pg_largeobject using btree(loid oid_ops, pageno int4_ops));
00176 #define LargeObjectLOidPNIndexId  2683
00177 
00178 DECLARE_UNIQUE_INDEX(pg_largeobject_metadata_oid_index, 2996, on pg_largeobject_metadata using btree(oid oid_ops));
00179 #define LargeObjectMetadataOidIndexId   2996
00180 
00181 DECLARE_UNIQUE_INDEX(pg_namespace_nspname_index, 2684, on pg_namespace using btree(nspname name_ops));
00182 #define NamespaceNameIndexId  2684
00183 DECLARE_UNIQUE_INDEX(pg_namespace_oid_index, 2685, on pg_namespace using btree(oid oid_ops));
00184 #define NamespaceOidIndexId  2685
00185 
00186 DECLARE_UNIQUE_INDEX(pg_opclass_am_name_nsp_index, 2686, on pg_opclass using btree(opcmethod oid_ops, opcname name_ops, opcnamespace oid_ops));
00187 #define OpclassAmNameNspIndexId  2686
00188 DECLARE_UNIQUE_INDEX(pg_opclass_oid_index, 2687, on pg_opclass using btree(oid oid_ops));
00189 #define OpclassOidIndexId  2687
00190 
00191 DECLARE_UNIQUE_INDEX(pg_operator_oid_index, 2688, on pg_operator using btree(oid oid_ops));
00192 #define OperatorOidIndexId  2688
00193 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));
00194 #define OperatorNameNspIndexId  2689
00195 
00196 DECLARE_UNIQUE_INDEX(pg_opfamily_am_name_nsp_index, 2754, on pg_opfamily using btree(opfmethod oid_ops, opfname name_ops, opfnamespace oid_ops));
00197 #define OpfamilyAmNameNspIndexId  2754
00198 DECLARE_UNIQUE_INDEX(pg_opfamily_oid_index, 2755, on pg_opfamily using btree(oid oid_ops));
00199 #define OpfamilyOidIndexId  2755
00200 
00201 DECLARE_UNIQUE_INDEX(pg_pltemplate_name_index, 1137, on pg_pltemplate using btree(tmplname name_ops));
00202 #define PLTemplateNameIndexId  1137
00203 
00204 DECLARE_UNIQUE_INDEX(pg_proc_oid_index, 2690, on pg_proc using btree(oid oid_ops));
00205 #define ProcedureOidIndexId  2690
00206 DECLARE_UNIQUE_INDEX(pg_proc_proname_args_nsp_index, 2691, on pg_proc using btree(proname name_ops, proargtypes oidvector_ops, pronamespace oid_ops));
00207 #define ProcedureNameArgsNspIndexId  2691
00208 
00209 DECLARE_UNIQUE_INDEX(pg_rewrite_oid_index, 2692, on pg_rewrite using btree(oid oid_ops));
00210 #define RewriteOidIndexId  2692
00211 DECLARE_UNIQUE_INDEX(pg_rewrite_rel_rulename_index, 2693, on pg_rewrite using btree(ev_class oid_ops, rulename name_ops));
00212 #define RewriteRelRulenameIndexId  2693
00213 
00214 /* This following index is not used for a cache and is not unique */
00215 DECLARE_INDEX(pg_shdepend_depender_index, 1232, on pg_shdepend using btree(dbid oid_ops, classid oid_ops, objid oid_ops, objsubid int4_ops));
00216 #define SharedDependDependerIndexId     1232
00217 /* This following index is not used for a cache and is not unique */
00218 DECLARE_INDEX(pg_shdepend_reference_index, 1233, on pg_shdepend using btree(refclassid oid_ops, refobjid oid_ops));
00219 #define SharedDependReferenceIndexId    1233
00220 
00221 DECLARE_UNIQUE_INDEX(pg_statistic_relid_att_inh_index, 2696, on pg_statistic using btree(starelid oid_ops, staattnum int2_ops, stainherit bool_ops));
00222 #define StatisticRelidAttnumInhIndexId  2696
00223 
00224 DECLARE_UNIQUE_INDEX(pg_tablespace_oid_index, 2697, on pg_tablespace using btree(oid oid_ops));
00225 #define TablespaceOidIndexId  2697
00226 DECLARE_UNIQUE_INDEX(pg_tablespace_spcname_index, 2698, on pg_tablespace using btree(spcname name_ops));
00227 #define TablespaceNameIndexId  2698
00228 
00229 /* This following index is not used for a cache and is not unique */
00230 DECLARE_INDEX(pg_trigger_tgconstraint_index, 2699, on pg_trigger using btree(tgconstraint oid_ops));
00231 #define TriggerConstraintIndexId  2699
00232 DECLARE_UNIQUE_INDEX(pg_trigger_tgrelid_tgname_index, 2701, on pg_trigger using btree(tgrelid oid_ops, tgname name_ops));
00233 #define TriggerRelidNameIndexId  2701
00234 DECLARE_UNIQUE_INDEX(pg_trigger_oid_index, 2702, on pg_trigger using btree(oid oid_ops));
00235 #define TriggerOidIndexId  2702
00236 
00237 DECLARE_UNIQUE_INDEX(pg_event_trigger_evtname_index, 3467, on pg_event_trigger using btree(evtname name_ops));
00238 #define EventTriggerNameIndexId  3467
00239 DECLARE_UNIQUE_INDEX(pg_event_trigger_oid_index, 3468, on pg_event_trigger using btree(oid oid_ops));
00240 #define EventTriggerOidIndexId  3468
00241 
00242 DECLARE_UNIQUE_INDEX(pg_ts_config_cfgname_index, 3608, on pg_ts_config using btree(cfgname name_ops, cfgnamespace oid_ops));
00243 #define TSConfigNameNspIndexId  3608
00244 DECLARE_UNIQUE_INDEX(pg_ts_config_oid_index, 3712, on pg_ts_config using btree(oid oid_ops));
00245 #define TSConfigOidIndexId  3712
00246 
00247 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));
00248 #define TSConfigMapIndexId  3609
00249 
00250 DECLARE_UNIQUE_INDEX(pg_ts_dict_dictname_index, 3604, on pg_ts_dict using btree(dictname name_ops, dictnamespace oid_ops));
00251 #define TSDictionaryNameNspIndexId  3604
00252 DECLARE_UNIQUE_INDEX(pg_ts_dict_oid_index, 3605, on pg_ts_dict using btree(oid oid_ops));
00253 #define TSDictionaryOidIndexId  3605
00254 
00255 DECLARE_UNIQUE_INDEX(pg_ts_parser_prsname_index, 3606, on pg_ts_parser using btree(prsname name_ops, prsnamespace oid_ops));
00256 #define TSParserNameNspIndexId  3606
00257 DECLARE_UNIQUE_INDEX(pg_ts_parser_oid_index, 3607, on pg_ts_parser using btree(oid oid_ops));
00258 #define TSParserOidIndexId  3607
00259 
00260 DECLARE_UNIQUE_INDEX(pg_ts_template_tmplname_index, 3766, on pg_ts_template using btree(tmplname name_ops, tmplnamespace oid_ops));
00261 #define TSTemplateNameNspIndexId    3766
00262 DECLARE_UNIQUE_INDEX(pg_ts_template_oid_index, 3767, on pg_ts_template using btree(oid oid_ops));
00263 #define TSTemplateOidIndexId    3767
00264 
00265 DECLARE_UNIQUE_INDEX(pg_type_oid_index, 2703, on pg_type using btree(oid oid_ops));
00266 #define TypeOidIndexId  2703
00267 DECLARE_UNIQUE_INDEX(pg_type_typname_nsp_index, 2704, on pg_type using btree(typname name_ops, typnamespace oid_ops));
00268 #define TypeNameNspIndexId  2704
00269 
00270 DECLARE_UNIQUE_INDEX(pg_foreign_data_wrapper_oid_index, 112, on pg_foreign_data_wrapper using btree(oid oid_ops));
00271 #define ForeignDataWrapperOidIndexId    112
00272 
00273 DECLARE_UNIQUE_INDEX(pg_foreign_data_wrapper_name_index, 548, on pg_foreign_data_wrapper using btree(fdwname name_ops));
00274 #define ForeignDataWrapperNameIndexId   548
00275 
00276 DECLARE_UNIQUE_INDEX(pg_foreign_server_oid_index, 113, on pg_foreign_server using btree(oid oid_ops));
00277 #define ForeignServerOidIndexId 113
00278 
00279 DECLARE_UNIQUE_INDEX(pg_foreign_server_name_index, 549, on pg_foreign_server using btree(srvname name_ops));
00280 #define ForeignServerNameIndexId    549
00281 
00282 DECLARE_UNIQUE_INDEX(pg_user_mapping_oid_index, 174, on pg_user_mapping using btree(oid oid_ops));
00283 #define UserMappingOidIndexId   174
00284 
00285 DECLARE_UNIQUE_INDEX(pg_user_mapping_user_server_index, 175, on pg_user_mapping using btree(umuser oid_ops, umserver oid_ops));
00286 #define UserMappingUserServerIndexId    175
00287 
00288 DECLARE_UNIQUE_INDEX(pg_foreign_table_relid_index, 3119, on pg_foreign_table using btree(ftrelid oid_ops));
00289 #define ForeignTableRelidIndexId 3119
00290 
00291 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));
00292 #define DefaultAclRoleNspObjIndexId 827
00293 DECLARE_UNIQUE_INDEX(pg_default_acl_oid_index, 828, on pg_default_acl using btree(oid oid_ops));
00294 #define DefaultAclOidIndexId    828
00295 
00296 DECLARE_UNIQUE_INDEX(pg_db_role_setting_databaseid_rol_index, 2965, on pg_db_role_setting using btree(setdatabase oid_ops, setrole oid_ops));
00297 #define DbRoleSettingDatidRolidIndexId  2965
00298 
00299 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));
00300 #define SecLabelObjectIndexId               3597
00301 
00302 DECLARE_UNIQUE_INDEX(pg_shseclabel_object_index, 3593, on pg_shseclabel using btree(objoid oid_ops, classoid oid_ops, provider text_ops));
00303 #define SharedSecLabelObjectIndexId         3593
00304 
00305 DECLARE_UNIQUE_INDEX(pg_extension_oid_index, 3080, on pg_extension using btree(oid oid_ops));
00306 #define ExtensionOidIndexId 3080
00307 
00308 DECLARE_UNIQUE_INDEX(pg_extension_name_index, 3081, on pg_extension using btree(extname name_ops));
00309 #define ExtensionNameIndexId 3081
00310 
00311 DECLARE_UNIQUE_INDEX(pg_range_rngtypid_index, 3542, on pg_range using btree(rngtypid oid_ops));
00312 #define RangeTypidIndexId                   3542
00313 
00314 /* last step of initialization script: build the indexes declared above */
00315 BUILD_INDICES
00316 
00317 #endif   /* INDEXING_H */