gooderp18绿色标准版
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

195 rindas
8.1KB

  1. /*-------------------------------------------------------------------------
  2. *
  3. * lsyscache.h
  4. * Convenience routines for common queries in the system catalog cache.
  5. *
  6. * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
  7. * Portions Copyright (c) 1994, Regents of the University of California
  8. *
  9. * src/include/utils/lsyscache.h
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef LSYSCACHE_H
  14. #define LSYSCACHE_H
  15. #include "access/attnum.h"
  16. #include "access/htup.h"
  17. #include "nodes/pg_list.h"
  18. /* Result list element for get_op_btree_interpretation */
  19. typedef struct OpBtreeInterpretation
  20. {
  21. Oid opfamily_id; /* btree opfamily containing operator */
  22. int strategy; /* its strategy number */
  23. Oid oplefttype; /* declared left input datatype */
  24. Oid oprighttype; /* declared right input datatype */
  25. } OpBtreeInterpretation;
  26. /* I/O function selector for get_type_io_data */
  27. typedef enum IOFuncSelector
  28. {
  29. IOFunc_input,
  30. IOFunc_output,
  31. IOFunc_receive,
  32. IOFunc_send
  33. } IOFuncSelector;
  34. /* Flag bits for get_attstatsslot */
  35. #define ATTSTATSSLOT_VALUES 0x01
  36. #define ATTSTATSSLOT_NUMBERS 0x02
  37. /* Result struct for get_attstatsslot */
  38. typedef struct AttStatsSlot
  39. {
  40. /* Always filled: */
  41. Oid staop; /* Actual staop for the found slot */
  42. Oid stacoll; /* Actual collation for the found slot */
  43. /* Filled if ATTSTATSSLOT_VALUES is specified: */
  44. Oid valuetype; /* Actual datatype of the values */
  45. Datum *values; /* slot's "values" array, or NULL if none */
  46. int nvalues; /* length of values[], or 0 */
  47. /* Filled if ATTSTATSSLOT_NUMBERS is specified: */
  48. float4 *numbers; /* slot's "numbers" array, or NULL if none */
  49. int nnumbers; /* length of numbers[], or 0 */
  50. /* Remaining fields are private to get_attstatsslot/free_attstatsslot */
  51. void *values_arr; /* palloc'd values array, if any */
  52. void *numbers_arr; /* palloc'd numbers array, if any */
  53. } AttStatsSlot;
  54. /* Hook for plugins to get control in get_attavgwidth() */
  55. typedef int32 (*get_attavgwidth_hook_type) (Oid relid, AttrNumber attnum);
  56. extern PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook;
  57. extern bool op_in_opfamily(Oid opno, Oid opfamily);
  58. extern int get_op_opfamily_strategy(Oid opno, Oid opfamily);
  59. extern Oid get_op_opfamily_sortfamily(Oid opno, Oid opfamily);
  60. extern void get_op_opfamily_properties(Oid opno, Oid opfamily, bool ordering_op,
  61. int *strategy,
  62. Oid *lefttype,
  63. Oid *righttype);
  64. extern Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype,
  65. int16 strategy);
  66. extern bool get_ordering_op_properties(Oid opno,
  67. Oid *opfamily, Oid *opcintype, int16 *strategy);
  68. extern Oid get_equality_op_for_ordering_op(Oid opno, bool *reverse);
  69. extern Oid get_ordering_op_for_equality_op(Oid opno, bool use_lhs_type);
  70. extern List *get_mergejoin_opfamilies(Oid opno);
  71. extern bool get_compatible_hash_operators(Oid opno,
  72. Oid *lhs_opno, Oid *rhs_opno);
  73. extern bool get_op_hash_functions(Oid opno,
  74. RegProcedure *lhs_procno, RegProcedure *rhs_procno);
  75. extern List *get_op_btree_interpretation(Oid opno);
  76. extern bool equality_ops_are_compatible(Oid opno1, Oid opno2);
  77. extern Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype,
  78. int16 procnum);
  79. extern char *get_attname(Oid relid, AttrNumber attnum, bool missing_ok);
  80. extern AttrNumber get_attnum(Oid relid, const char *attname);
  81. extern char get_attgenerated(Oid relid, AttrNumber attnum);
  82. extern Oid get_atttype(Oid relid, AttrNumber attnum);
  83. extern void get_atttypetypmodcoll(Oid relid, AttrNumber attnum,
  84. Oid *typid, int32 *typmod, Oid *collid);
  85. extern char *get_collation_name(Oid colloid);
  86. extern bool get_collation_isdeterministic(Oid colloid);
  87. extern char *get_constraint_name(Oid conoid);
  88. extern char *get_language_name(Oid langoid, bool missing_ok);
  89. extern Oid get_opclass_family(Oid opclass);
  90. extern Oid get_opclass_input_type(Oid opclass);
  91. extern bool get_opclass_opfamily_and_input_type(Oid opclass,
  92. Oid *opfamily, Oid *opcintype);
  93. extern RegProcedure get_opcode(Oid opno);
  94. extern char *get_opname(Oid opno);
  95. extern Oid get_op_rettype(Oid opno);
  96. extern void op_input_types(Oid opno, Oid *lefttype, Oid *righttype);
  97. extern bool op_mergejoinable(Oid opno, Oid inputtype);
  98. extern bool op_hashjoinable(Oid opno, Oid inputtype);
  99. extern bool op_strict(Oid opno);
  100. extern char op_volatile(Oid opno);
  101. extern Oid get_commutator(Oid opno);
  102. extern Oid get_negator(Oid opno);
  103. extern RegProcedure get_oprrest(Oid opno);
  104. extern RegProcedure get_oprjoin(Oid opno);
  105. extern char *get_func_name(Oid funcid);
  106. extern Oid get_func_namespace(Oid funcid);
  107. extern Oid get_func_rettype(Oid funcid);
  108. extern int get_func_nargs(Oid funcid);
  109. extern Oid get_func_signature(Oid funcid, Oid **argtypes, int *nargs);
  110. extern Oid get_func_variadictype(Oid funcid);
  111. extern bool get_func_retset(Oid funcid);
  112. extern bool func_strict(Oid funcid);
  113. extern char func_volatile(Oid funcid);
  114. extern char func_parallel(Oid funcid);
  115. extern char get_func_prokind(Oid funcid);
  116. extern bool get_func_leakproof(Oid funcid);
  117. extern RegProcedure get_func_support(Oid funcid);
  118. extern Oid get_relname_relid(const char *relname, Oid relnamespace);
  119. extern char *get_rel_name(Oid relid);
  120. extern Oid get_rel_namespace(Oid relid);
  121. extern Oid get_rel_type_id(Oid relid);
  122. extern char get_rel_relkind(Oid relid);
  123. extern bool get_rel_relispartition(Oid relid);
  124. extern Oid get_rel_tablespace(Oid relid);
  125. extern char get_rel_persistence(Oid relid);
  126. extern Oid get_transform_fromsql(Oid typid, Oid langid, List *trftypes);
  127. extern Oid get_transform_tosql(Oid typid, Oid langid, List *trftypes);
  128. extern bool get_typisdefined(Oid typid);
  129. extern int16 get_typlen(Oid typid);
  130. extern bool get_typbyval(Oid typid);
  131. extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
  132. extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
  133. char *typalign);
  134. extern Oid getTypeIOParam(HeapTuple typeTuple);
  135. extern void get_type_io_data(Oid typid,
  136. IOFuncSelector which_func,
  137. int16 *typlen,
  138. bool *typbyval,
  139. char *typalign,
  140. char *typdelim,
  141. Oid *typioparam,
  142. Oid *func);
  143. extern char get_typstorage(Oid typid);
  144. extern Node *get_typdefault(Oid typid);
  145. extern char get_typtype(Oid typid);
  146. extern bool type_is_rowtype(Oid typid);
  147. extern bool type_is_enum(Oid typid);
  148. extern bool type_is_range(Oid typid);
  149. extern void get_type_category_preferred(Oid typid,
  150. char *typcategory,
  151. bool *typispreferred);
  152. extern Oid get_typ_typrelid(Oid typid);
  153. extern Oid get_element_type(Oid typid);
  154. extern Oid get_array_type(Oid typid);
  155. extern Oid get_promoted_array_type(Oid typid);
  156. extern Oid get_base_element_type(Oid typid);
  157. extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam);
  158. extern void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena);
  159. extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typIOParam);
  160. extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, bool *typIsVarlena);
  161. extern Oid get_typmodin(Oid typid);
  162. extern Oid get_typcollation(Oid typid);
  163. extern bool type_is_collatable(Oid typid);
  164. extern Oid getBaseType(Oid typid);
  165. extern Oid getBaseTypeAndTypmod(Oid typid, int32 *typmod);
  166. extern int32 get_typavgwidth(Oid typid, int32 typmod);
  167. extern int32 get_attavgwidth(Oid relid, AttrNumber attnum);
  168. extern bool get_attstatsslot(AttStatsSlot *sslot, HeapTuple statstuple,
  169. int reqkind, Oid reqop, int flags);
  170. extern void free_attstatsslot(AttStatsSlot *sslot);
  171. extern char *get_namespace_name(Oid nspid);
  172. extern char *get_namespace_name_or_temp(Oid nspid);
  173. extern Oid get_range_subtype(Oid rangeOid);
  174. extern Oid get_range_collation(Oid rangeOid);
  175. extern Oid get_index_column_opclass(Oid index_oid, int attno);
  176. extern bool get_index_isreplident(Oid index_oid);
  177. extern bool get_index_isvalid(Oid index_oid);
  178. extern bool get_index_isclustered(Oid index_oid);
  179. #define type_is_array(typid) (get_element_type(typid) != InvalidOid)
  180. /* type_is_array_domain accepts both plain arrays and domains over arrays */
  181. #define type_is_array_domain(typid) (get_base_element_type(typid) != InvalidOid)
  182. #define TypeIsToastable(typid) (get_typstorage(typid) != 'p')
  183. #endif /* LSYSCACHE_H */
上海开阖软件有限公司 沪ICP备12045867号-1