gooderp18绿色标准版
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

220 行
6.3KB

  1. /*-------------------------------------------------------------------------
  2. *
  3. * syscache.h
  4. * System catalog cache definitions.
  5. *
  6. * See also lsyscache.h, which provides convenience routines for
  7. * common cache-lookup operations.
  8. *
  9. * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
  10. * Portions Copyright (c) 1994, Regents of the University of California
  11. *
  12. * src/include/utils/syscache.h
  13. *
  14. *-------------------------------------------------------------------------
  15. */
  16. #ifndef SYSCACHE_H
  17. #define SYSCACHE_H
  18. #include "access/attnum.h"
  19. #include "access/htup.h"
  20. /* we intentionally do not include utils/catcache.h here */
  21. /*
  22. * SysCache identifiers.
  23. *
  24. * The order of these identifiers must match the order
  25. * of the entries in the array cacheinfo[] in syscache.c.
  26. * Keep them in alphabetical order (renumbering only costs a
  27. * backend rebuild).
  28. */
  29. enum SysCacheIdentifier
  30. {
  31. AGGFNOID = 0,
  32. AMNAME,
  33. AMOID,
  34. AMOPOPID,
  35. AMOPSTRATEGY,
  36. AMPROCNUM,
  37. ATTNAME,
  38. ATTNUM,
  39. AUTHMEMMEMROLE,
  40. AUTHMEMROLEMEM,
  41. AUTHNAME,
  42. AUTHOID,
  43. CASTSOURCETARGET,
  44. CLAAMNAMENSP,
  45. CLAOID,
  46. COLLNAMEENCNSP,
  47. COLLOID,
  48. CONDEFAULT,
  49. CONNAMENSP,
  50. CONSTROID,
  51. CONVOID,
  52. DATABASEOID,
  53. DEFACLROLENSPOBJ,
  54. ENUMOID,
  55. ENUMTYPOIDNAME,
  56. EVENTTRIGGERNAME,
  57. EVENTTRIGGEROID,
  58. FOREIGNDATAWRAPPERNAME,
  59. FOREIGNDATAWRAPPEROID,
  60. FOREIGNSERVERNAME,
  61. FOREIGNSERVEROID,
  62. FOREIGNTABLEREL,
  63. INDEXRELID,
  64. LANGNAME,
  65. LANGOID,
  66. NAMESPACENAME,
  67. NAMESPACEOID,
  68. OPERNAMENSP,
  69. OPEROID,
  70. OPFAMILYAMNAMENSP,
  71. OPFAMILYOID,
  72. PARTRELID,
  73. PROCNAMEARGSNSP,
  74. PROCOID,
  75. PUBLICATIONNAME,
  76. PUBLICATIONOID,
  77. PUBLICATIONREL,
  78. PUBLICATIONRELMAP,
  79. RANGETYPE,
  80. RELNAMENSP,
  81. RELOID,
  82. REPLORIGIDENT,
  83. REPLORIGNAME,
  84. RULERELNAME,
  85. SEQRELID,
  86. STATEXTDATASTXOID,
  87. STATEXTNAMENSP,
  88. STATEXTOID,
  89. STATRELATTINH,
  90. SUBSCRIPTIONNAME,
  91. SUBSCRIPTIONOID,
  92. SUBSCRIPTIONRELMAP,
  93. TABLESPACEOID,
  94. TRFOID,
  95. TRFTYPELANG,
  96. TSCONFIGMAP,
  97. TSCONFIGNAMENSP,
  98. TSCONFIGOID,
  99. TSDICTNAMENSP,
  100. TSDICTOID,
  101. TSPARSERNAMENSP,
  102. TSPARSEROID,
  103. TSTEMPLATENAMENSP,
  104. TSTEMPLATEOID,
  105. TYPENAMENSP,
  106. TYPEOID,
  107. USERMAPPINGOID,
  108. USERMAPPINGUSERSERVER
  109. #define SysCacheSize (USERMAPPINGUSERSERVER + 1)
  110. };
  111. extern void InitCatalogCache(void);
  112. extern void InitCatalogCachePhase2(void);
  113. extern HeapTuple SearchSysCache(int cacheId,
  114. Datum key1, Datum key2, Datum key3, Datum key4);
  115. /*
  116. * The use of argument specific numbers is encouraged. They're faster, and
  117. * insulates the caller from changes in the maximum number of keys.
  118. */
  119. extern HeapTuple SearchSysCache1(int cacheId,
  120. Datum key1);
  121. extern HeapTuple SearchSysCache2(int cacheId,
  122. Datum key1, Datum key2);
  123. extern HeapTuple SearchSysCache3(int cacheId,
  124. Datum key1, Datum key2, Datum key3);
  125. extern HeapTuple SearchSysCache4(int cacheId,
  126. Datum key1, Datum key2, Datum key3, Datum key4);
  127. extern void ReleaseSysCache(HeapTuple tuple);
  128. /* convenience routines */
  129. extern HeapTuple SearchSysCacheCopy(int cacheId,
  130. Datum key1, Datum key2, Datum key3, Datum key4);
  131. extern bool SearchSysCacheExists(int cacheId,
  132. Datum key1, Datum key2, Datum key3, Datum key4);
  133. extern Oid GetSysCacheOid(int cacheId, AttrNumber oidcol,
  134. Datum key1, Datum key2, Datum key3, Datum key4);
  135. extern HeapTuple SearchSysCacheAttName(Oid relid, const char *attname);
  136. extern HeapTuple SearchSysCacheCopyAttName(Oid relid, const char *attname);
  137. extern bool SearchSysCacheExistsAttName(Oid relid, const char *attname);
  138. extern HeapTuple SearchSysCacheAttNum(Oid relid, int16 attnum);
  139. extern HeapTuple SearchSysCacheCopyAttNum(Oid relid, int16 attnum);
  140. extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup,
  141. AttrNumber attributeNumber, bool *isNull);
  142. extern uint32 GetSysCacheHashValue(int cacheId,
  143. Datum key1, Datum key2, Datum key3, Datum key4);
  144. /* list-search interface. Users of this must import catcache.h too */
  145. struct catclist;
  146. extern struct catclist *SearchSysCacheList(int cacheId, int nkeys,
  147. Datum key1, Datum key2, Datum key3);
  148. extern void SysCacheInvalidate(int cacheId, uint32 hashValue);
  149. extern bool RelationInvalidatesSnapshotsOnly(Oid relid);
  150. extern bool RelationHasSysCache(Oid relid);
  151. extern bool RelationSupportsSysCache(Oid relid);
  152. /*
  153. * The use of the macros below rather than direct calls to the corresponding
  154. * functions is encouraged, as it insulates the caller from changes in the
  155. * maximum number of keys.
  156. */
  157. #define SearchSysCacheCopy1(cacheId, key1) \
  158. SearchSysCacheCopy(cacheId, key1, 0, 0, 0)
  159. #define SearchSysCacheCopy2(cacheId, key1, key2) \
  160. SearchSysCacheCopy(cacheId, key1, key2, 0, 0)
  161. #define SearchSysCacheCopy3(cacheId, key1, key2, key3) \
  162. SearchSysCacheCopy(cacheId, key1, key2, key3, 0)
  163. #define SearchSysCacheCopy4(cacheId, key1, key2, key3, key4) \
  164. SearchSysCacheCopy(cacheId, key1, key2, key3, key4)
  165. #define SearchSysCacheExists1(cacheId, key1) \
  166. SearchSysCacheExists(cacheId, key1, 0, 0, 0)
  167. #define SearchSysCacheExists2(cacheId, key1, key2) \
  168. SearchSysCacheExists(cacheId, key1, key2, 0, 0)
  169. #define SearchSysCacheExists3(cacheId, key1, key2, key3) \
  170. SearchSysCacheExists(cacheId, key1, key2, key3, 0)
  171. #define SearchSysCacheExists4(cacheId, key1, key2, key3, key4) \
  172. SearchSysCacheExists(cacheId, key1, key2, key3, key4)
  173. #define GetSysCacheOid1(cacheId, oidcol, key1) \
  174. GetSysCacheOid(cacheId, oidcol, key1, 0, 0, 0)
  175. #define GetSysCacheOid2(cacheId, oidcol, key1, key2) \
  176. GetSysCacheOid(cacheId, oidcol, key1, key2, 0, 0)
  177. #define GetSysCacheOid3(cacheId, oidcol, key1, key2, key3) \
  178. GetSysCacheOid(cacheId, oidcol, key1, key2, key3, 0)
  179. #define GetSysCacheOid4(cacheId, oidcol, key1, key2, key3, key4) \
  180. GetSysCacheOid(cacheId, oidcol, key1, key2, key3, key4)
  181. #define GetSysCacheHashValue1(cacheId, key1) \
  182. GetSysCacheHashValue(cacheId, key1, 0, 0, 0)
  183. #define GetSysCacheHashValue2(cacheId, key1, key2) \
  184. GetSysCacheHashValue(cacheId, key1, key2, 0, 0)
  185. #define GetSysCacheHashValue3(cacheId, key1, key2, key3) \
  186. GetSysCacheHashValue(cacheId, key1, key2, key3, 0)
  187. #define GetSysCacheHashValue4(cacheId, key1, key2, key3, key4) \
  188. GetSysCacheHashValue(cacheId, key1, key2, key3, key4)
  189. #define SearchSysCacheList1(cacheId, key1) \
  190. SearchSysCacheList(cacheId, 1, key1, 0, 0)
  191. #define SearchSysCacheList2(cacheId, key1, key2) \
  192. SearchSysCacheList(cacheId, 2, key1, key2, 0)
  193. #define SearchSysCacheList3(cacheId, key1, key2, key3) \
  194. SearchSysCacheList(cacheId, 3, key1, key2, key3)
  195. #define ReleaseSysCacheList(x) ReleaseCatCacheList(x)
  196. #endif /* SYSCACHE_H */
上海开阖软件有限公司 沪ICP备12045867号-1