indexing.h
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:5k
源码类别:

数据库系统

开发平台:

Unix_Linux

  1. /*-------------------------------------------------------------------------
  2.  *
  3.  * indexing.h
  4.  *   This include provides some definitions to support indexing
  5.  *   on system catalogs
  6.  *
  7.  *
  8.  * Copyright (c) 1994, Regents of the University of California
  9.  *
  10.  * $Id: indexing.h,v 1.19 1999/02/13 23:21:03 momjian Exp $
  11.  *
  12.  *-------------------------------------------------------------------------
  13.  */
  14. #ifndef INDEXING_H
  15. #define INDEXING_H
  16. #include <access/htup.h>
  17. #include <utils/rel.h>
  18. /*
  19.  * Some definitions for indices on pg_attribute
  20.  */
  21. #define Num_pg_attr_indices 3
  22. #define Num_pg_proc_indices 3
  23. #define Num_pg_type_indices 2
  24. #define Num_pg_class_indices 2
  25. #define Num_pg_attrdef_indices 1
  26. #define Num_pg_relcheck_indices 1
  27. #define Num_pg_trigger_indices 1
  28. #define Num_pg_description_indices 1
  29. /*
  30.  * Names of indices on system catalogs
  31.  */
  32. #define AttributeNameIndex "pg_attribute_relid_attnam_index"
  33. #define AttributeNumIndex  "pg_attribute_relid_attnum_index"
  34. #define AttributeRelidIndex "pg_attribute_attrelid_index"
  35. #define ProcedureOidIndex  "pg_proc_oid_index"
  36. #define ProcedureNameIndex "pg_proc_proname_narg_type_index"
  37. #define ProcedureSrcIndex  "pg_proc_prosrc_index"
  38. #define TypeOidIndex    "pg_type_oid_index"
  39. #define TypeNameIndex    "pg_type_typname_index"
  40. #define ClassOidIndex    "pg_class_oid_index"
  41. #define ClassNameIndex    "pg_class_relname_index"
  42. #define AttrDefaultIndex   "pg_attrdef_adrelid_index"
  43. #define RelCheckIndex    "pg_relcheck_rcrelid_index"
  44. #define TriggerRelidIndex  "pg_trigger_tgrelid_index"
  45. #define DescriptionObjIndex "pg_description_objoid_index"
  46. extern char *Name_pg_attr_indices[];
  47. extern char *Name_pg_proc_indices[];
  48. extern char *Name_pg_type_indices[];
  49. extern char *Name_pg_class_indices[];
  50. extern char *Name_pg_attrdef_indices[];
  51. extern char *Name_pg_relcheck_indices[];
  52. extern char *Name_pg_trigger_indices[];
  53. extern char *Name_pg_description_indices[];
  54. extern char *IndexedCatalogNames[];
  55. /*
  56.  * indexing.c prototypes
  57.  *
  58.  * Functions for each index to perform the necessary scan on a cache miss.
  59.  */
  60. extern void CatalogOpenIndices(int nIndices, char **names, Relation *idescs);
  61. extern void CatalogCloseIndices(int nIndices, Relation *idescs);
  62. extern void CatalogIndexInsert(Relation *idescs,
  63.    int nIndices,
  64.    Relation heapRelation,
  65.    HeapTuple heapTuple);
  66. extern bool CatalogHasIndex(char *catName, Oid catId);
  67. extern HeapTuple AttributeNameIndexScan(Relation heapRelation,
  68.    Oid relid,
  69.    char *attname);
  70. extern HeapTuple AttributeNumIndexScan(Relation heapRelation,
  71.   Oid relid,
  72.   AttrNumber attnum);
  73. extern HeapTuple ProcedureOidIndexScan(Relation heapRelation, Oid procId);
  74. extern HeapTuple ProcedureNameIndexScan(Relation heapRelation,
  75.    char *procName, int2 nargs, Oid *argTypes);
  76. extern HeapTuple ProcedureSrcIndexScan(Relation heapRelation, text *procSrc);
  77. extern HeapTuple TypeOidIndexScan(Relation heapRelation, Oid typeId);
  78. extern HeapTuple TypeNameIndexScan(Relation heapRelation, char *typeName);
  79. extern HeapTuple ClassNameIndexScan(Relation heapRelation, char *relName);
  80. extern HeapTuple ClassOidIndexScan(Relation heapRelation, Oid relId);
  81. /*
  82.  * What follows are lines processed by genbki.sh to create the statements
  83.  * the bootstrap parser will turn into DefineIndex commands.
  84.  *
  85.  * The keyword is DECLARE_INDEX every thing after that is just like in a
  86.  * normal specification of the 'define index' POSTQUEL command.
  87.  */
  88. DECLARE_INDEX(pg_attribute_relid_attnam_index on pg_attribute using btree(attrelid oid_ops, attname name_ops));
  89. DECLARE_INDEX(pg_attribute_relid_attnum_index on pg_attribute using btree(attrelid oid_ops, attnum int2_ops));
  90. DECLARE_INDEX(pg_attribute_attrelid_index on pg_attribute using btree(attrelid oid_ops));
  91. DECLARE_INDEX(pg_proc_oid_index on pg_proc using btree(oid oid_ops));
  92. DECLARE_INDEX(pg_proc_proname_narg_type_index on pg_proc using btree(proname name_ops, pronargs int2_ops, proargtypes oid8_ops));
  93. DECLARE_INDEX(pg_proc_prosrc_index on pg_proc using btree(prosrc text_ops));
  94. DECLARE_INDEX(pg_type_oid_index on pg_type using btree(oid oid_ops));
  95. DECLARE_INDEX(pg_type_typname_index on pg_type using btree(typname name_ops));
  96. DECLARE_INDEX(pg_class_oid_index on pg_class using btree(oid oid_ops));
  97. DECLARE_INDEX(pg_class_relname_index on pg_class using btree(relname name_ops));
  98. DECLARE_INDEX(pg_attrdef_adrelid_index on pg_attrdef using btree(adrelid oid_ops));
  99. DECLARE_INDEX(pg_relcheck_rcrelid_index on pg_relcheck using btree(rcrelid oid_ops));
  100. DECLARE_INDEX(pg_trigger_tgrelid_index on pg_trigger using btree(tgrelid oid_ops));
  101. DECLARE_INDEX(pg_description_objoid_index on pg_description using btree(objoid oid_ops));
  102. /* now build indices in the initialization scripts */
  103. BUILD_INDICES
  104. #endif  /* INDEXING_H */