gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
4.2KB

  1. /*-------------------------------------------------------------------------
  2. *
  3. * relcache.h
  4. * Relation descriptor cache definitions.
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
  8. * Portions Copyright (c) 1994, Regents of the University of California
  9. *
  10. * src/include/utils/relcache.h
  11. *
  12. *-------------------------------------------------------------------------
  13. */
  14. #ifndef RELCACHE_H
  15. #define RELCACHE_H
  16. #include "access/tupdesc.h"
  17. #include "nodes/bitmapset.h"
  18. /*
  19. * Name of relcache init file(s), used to speed up backend startup
  20. */
  21. #define RELCACHE_INIT_FILENAME "pg_internal.init"
  22. typedef struct RelationData *Relation;
  23. /* ----------------
  24. * RelationPtr is used in the executor to support index scans
  25. * where we have to keep track of several index relations in an
  26. * array. -cim 9/10/89
  27. * ----------------
  28. */
  29. typedef Relation *RelationPtr;
  30. /*
  31. * Routines to open (lookup) and close a relcache entry
  32. */
  33. extern Relation RelationIdGetRelation(Oid relationId);
  34. extern void RelationClose(Relation relation);
  35. /*
  36. * Routines to compute/retrieve additional cached information
  37. */
  38. extern List *RelationGetFKeyList(Relation relation);
  39. extern List *RelationGetIndexList(Relation relation);
  40. extern List *RelationGetStatExtList(Relation relation);
  41. extern Oid RelationGetPrimaryKeyIndex(Relation relation);
  42. extern Oid RelationGetReplicaIndex(Relation relation);
  43. extern List *RelationGetIndexExpressions(Relation relation);
  44. extern List *RelationGetDummyIndexExpressions(Relation relation);
  45. extern List *RelationGetIndexPredicate(Relation relation);
  46. typedef enum IndexAttrBitmapKind
  47. {
  48. INDEX_ATTR_BITMAP_ALL,
  49. INDEX_ATTR_BITMAP_KEY,
  50. INDEX_ATTR_BITMAP_PRIMARY_KEY,
  51. INDEX_ATTR_BITMAP_IDENTITY_KEY
  52. } IndexAttrBitmapKind;
  53. extern Bitmapset *RelationGetIndexAttrBitmap(Relation relation,
  54. IndexAttrBitmapKind keyAttrs);
  55. extern void RelationGetExclusionInfo(Relation indexRelation,
  56. Oid **operators,
  57. Oid **procs,
  58. uint16 **strategies);
  59. extern void RelationInitIndexAccessInfo(Relation relation);
  60. /* caller must include pg_publication.h */
  61. struct PublicationActions;
  62. extern struct PublicationActions *GetRelationPublicationActions(Relation relation);
  63. extern void RelationInitTableAccessMethod(Relation relation);
  64. /*
  65. * Routines to support ereport() reports of relation-related errors
  66. */
  67. extern int errtable(Relation rel);
  68. extern int errtablecol(Relation rel, int attnum);
  69. extern int errtablecolname(Relation rel, const char *colname);
  70. extern int errtableconstraint(Relation rel, const char *conname);
  71. /*
  72. * Routines for backend startup
  73. */
  74. extern void RelationCacheInitialize(void);
  75. extern void RelationCacheInitializePhase2(void);
  76. extern void RelationCacheInitializePhase3(void);
  77. /*
  78. * Routine to create a relcache entry for an about-to-be-created relation
  79. */
  80. extern Relation RelationBuildLocalRelation(const char *relname,
  81. Oid relnamespace,
  82. TupleDesc tupDesc,
  83. Oid relid,
  84. Oid accessmtd,
  85. Oid relfilenode,
  86. Oid reltablespace,
  87. bool shared_relation,
  88. bool mapped_relation,
  89. char relpersistence,
  90. char relkind);
  91. /*
  92. * Routine to manage assignment of new relfilenode to a relation
  93. */
  94. extern void RelationSetNewRelfilenode(Relation relation, char persistence);
  95. /*
  96. * Routines for flushing/rebuilding relcache entries in various scenarios
  97. */
  98. extern void RelationForgetRelation(Oid rid);
  99. extern void RelationCacheInvalidateEntry(Oid relationId);
  100. extern void RelationCacheInvalidate(void);
  101. extern void RelationCloseSmgrByOid(Oid relationId);
  102. extern void AtEOXact_RelationCache(bool isCommit);
  103. extern void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid,
  104. SubTransactionId parentSubid);
  105. /*
  106. * Routines to help manage rebuilding of relcache init files
  107. */
  108. extern bool RelationIdIsInInitFile(Oid relationId);
  109. extern void RelationCacheInitFilePreInvalidate(void);
  110. extern void RelationCacheInitFilePostInvalidate(void);
  111. extern void RelationCacheInitFileRemove(void);
  112. /* should be used only by relcache.c and catcache.c */
  113. extern bool criticalRelcachesBuilt;
  114. /* should be used only by relcache.c and postinit.c */
  115. extern bool criticalSharedRelcachesBuilt;
  116. #endif /* RELCACHE_H */
上海开阖软件有限公司 沪ICP备12045867号-1