00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef LSYSCACHE_H
00014 #define LSYSCACHE_H
00015
00016 #include "access/attnum.h"
00017 #include "access/htup.h"
00018 #include "nodes/pg_list.h"
00019
00020
00021 typedef struct OpBtreeInterpretation
00022 {
00023 Oid opfamily_id;
00024 int strategy;
00025 Oid oplefttype;
00026 Oid oprighttype;
00027 } OpBtreeInterpretation;
00028
00029
00030 typedef enum IOFuncSelector
00031 {
00032 IOFunc_input,
00033 IOFunc_output,
00034 IOFunc_receive,
00035 IOFunc_send
00036 } IOFuncSelector;
00037
00038
00039 typedef int32 (*get_attavgwidth_hook_type) (Oid relid, AttrNumber attnum);
00040 extern PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook;
00041
00042 extern bool op_in_opfamily(Oid opno, Oid opfamily);
00043 extern int get_op_opfamily_strategy(Oid opno, Oid opfamily);
00044 extern Oid get_op_opfamily_sortfamily(Oid opno, Oid opfamily);
00045 extern void get_op_opfamily_properties(Oid opno, Oid opfamily, bool ordering_op,
00046 int *strategy,
00047 Oid *lefttype,
00048 Oid *righttype);
00049 extern Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype,
00050 int16 strategy);
00051 extern bool get_ordering_op_properties(Oid opno,
00052 Oid *opfamily, Oid *opcintype, int16 *strategy);
00053 extern bool get_sort_function_for_ordering_op(Oid opno, Oid *sortfunc,
00054 bool *issupport, bool *reverse);
00055 extern Oid get_equality_op_for_ordering_op(Oid opno, bool *reverse);
00056 extern Oid get_ordering_op_for_equality_op(Oid opno, bool use_lhs_type);
00057 extern List *get_mergejoin_opfamilies(Oid opno);
00058 extern bool get_compatible_hash_operators(Oid opno,
00059 Oid *lhs_opno, Oid *rhs_opno);
00060 extern bool get_op_hash_functions(Oid opno,
00061 RegProcedure *lhs_procno, RegProcedure *rhs_procno);
00062 extern List *get_op_btree_interpretation(Oid opno);
00063 extern bool equality_ops_are_compatible(Oid opno1, Oid opno2);
00064 extern Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype,
00065 int16 procnum);
00066 extern char *get_attname(Oid relid, AttrNumber attnum);
00067 extern char *get_relid_attribute_name(Oid relid, AttrNumber attnum);
00068 extern AttrNumber get_attnum(Oid relid, const char *attname);
00069 extern Oid get_atttype(Oid relid, AttrNumber attnum);
00070 extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
00071 extern void get_atttypetypmodcoll(Oid relid, AttrNumber attnum,
00072 Oid *typid, int32 *typmod, Oid *collid);
00073 extern char *get_collation_name(Oid colloid);
00074 extern char *get_constraint_name(Oid conoid);
00075 extern Oid get_opclass_family(Oid opclass);
00076 extern Oid get_opclass_input_type(Oid opclass);
00077 extern RegProcedure get_opcode(Oid opno);
00078 extern char *get_opname(Oid opno);
00079 extern void op_input_types(Oid opno, Oid *lefttype, Oid *righttype);
00080 extern bool op_mergejoinable(Oid opno, Oid inputtype);
00081 extern bool op_hashjoinable(Oid opno, Oid inputtype);
00082 extern bool op_strict(Oid opno);
00083 extern char op_volatile(Oid opno);
00084 extern Oid get_commutator(Oid opno);
00085 extern Oid get_negator(Oid opno);
00086 extern RegProcedure get_oprrest(Oid opno);
00087 extern RegProcedure get_oprjoin(Oid opno);
00088 extern char *get_func_name(Oid funcid);
00089 extern Oid get_func_namespace(Oid funcid);
00090 extern Oid get_func_rettype(Oid funcid);
00091 extern int get_func_nargs(Oid funcid);
00092 extern Oid get_func_signature(Oid funcid, Oid **argtypes, int *nargs);
00093 extern bool get_func_retset(Oid funcid);
00094 extern bool func_strict(Oid funcid);
00095 extern char func_volatile(Oid funcid);
00096 extern bool get_func_leakproof(Oid funcid);
00097 extern float4 get_func_cost(Oid funcid);
00098 extern float4 get_func_rows(Oid funcid);
00099 extern Oid get_relname_relid(const char *relname, Oid relnamespace);
00100 extern char *get_rel_name(Oid relid);
00101 extern Oid get_rel_namespace(Oid relid);
00102 extern Oid get_rel_type_id(Oid relid);
00103 extern char get_rel_relkind(Oid relid);
00104 extern Oid get_rel_tablespace(Oid relid);
00105 extern bool get_typisdefined(Oid typid);
00106 extern int16 get_typlen(Oid typid);
00107 extern bool get_typbyval(Oid typid);
00108 extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
00109 extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
00110 char *typalign);
00111 extern Oid getTypeIOParam(HeapTuple typeTuple);
00112 extern void get_type_io_data(Oid typid,
00113 IOFuncSelector which_func,
00114 int16 *typlen,
00115 bool *typbyval,
00116 char *typalign,
00117 char *typdelim,
00118 Oid *typioparam,
00119 Oid *func);
00120 extern char get_typstorage(Oid typid);
00121 extern Node *get_typdefault(Oid typid);
00122 extern char get_typtype(Oid typid);
00123 extern bool type_is_rowtype(Oid typid);
00124 extern bool type_is_enum(Oid typid);
00125 extern bool type_is_range(Oid typid);
00126 extern void get_type_category_preferred(Oid typid,
00127 char *typcategory,
00128 bool *typispreferred);
00129 extern Oid get_typ_typrelid(Oid typid);
00130 extern Oid get_element_type(Oid typid);
00131 extern Oid get_array_type(Oid typid);
00132 extern Oid get_base_element_type(Oid typid);
00133 extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam);
00134 extern void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena);
00135 extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typIOParam);
00136 extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, bool *typIsVarlena);
00137 extern Oid get_typmodin(Oid typid);
00138 extern Oid get_typcollation(Oid typid);
00139 extern bool type_is_collatable(Oid typid);
00140 extern Oid getBaseType(Oid typid);
00141 extern Oid getBaseTypeAndTypmod(Oid typid, int32 *typmod);
00142 extern int32 get_typavgwidth(Oid typid, int32 typmod);
00143 extern int32 get_attavgwidth(Oid relid, AttrNumber attnum);
00144 extern bool get_attstatsslot(HeapTuple statstuple,
00145 Oid atttype, int32 atttypmod,
00146 int reqkind, Oid reqop,
00147 Oid *actualop,
00148 Datum **values, int *nvalues,
00149 float4 **numbers, int *nnumbers);
00150 extern void free_attstatsslot(Oid atttype,
00151 Datum *values, int nvalues,
00152 float4 *numbers, int nnumbers);
00153 extern char *get_namespace_name(Oid nspid);
00154 extern Oid get_range_subtype(Oid rangeOid);
00155
00156 #define type_is_array(typid) (get_element_type(typid) != InvalidOid)
00157
00158 #define type_is_array_domain(typid) (get_base_element_type(typid) != InvalidOid)
00159
00160 #define TypeIsToastable(typid) (get_typstorage(typid) != 'p')
00161
00162 #endif