]> granicus.if.org Git - postgresql/blob - src/include/utils/lsyscache.h
Change the planner-to-executor API so that the planner tells the executor
[postgresql] / src / include / utils / lsyscache.h
1 /*-------------------------------------------------------------------------
2  *
3  * lsyscache.h
4  *        Convenience routines for common queries in the system catalog cache.
5  *
6  * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.112 2007/01/10 18:06:05 tgl Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef LSYSCACHE_H
14 #define LSYSCACHE_H
15
16 #include "access/attnum.h"
17 #include "access/htup.h"
18 #include "nodes/pg_list.h"
19
20 /* I/O function selector for get_type_io_data */
21 typedef enum IOFuncSelector
22 {
23         IOFunc_input,
24         IOFunc_output,
25         IOFunc_receive,
26         IOFunc_send
27 } IOFuncSelector;
28
29 extern bool op_in_opfamily(Oid opno, Oid opfamily);
30 extern int      get_op_opfamily_strategy(Oid opno, Oid opfamily);
31 extern void get_op_opfamily_properties(Oid opno, Oid opfamily,
32                                                   int *strategy,
33                                                   Oid *lefttype,
34                                                   Oid *righttype,
35                                                   bool *recheck);
36 extern Oid      get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype,
37                                                                 int16 strategy);
38 extern bool get_op_mergejoin_info(Oid eq_op, Oid *left_sortop,
39                                           Oid *right_sortop, Oid *opfamily);
40 extern bool get_compare_function_for_ordering_op(Oid opno,
41                                                                                                  Oid *cmpfunc, bool *reverse);
42 extern Oid      get_equality_op_for_ordering_op(Oid opno);
43 extern Oid      get_ordering_op_for_equality_op(Oid opno, bool use_lhs_type);
44 extern Oid      get_compatible_hash_operator(Oid opno, bool use_lhs_type);
45 extern Oid      get_op_hash_function(Oid opno);
46 extern void get_op_btree_interpretation(Oid opno,
47                                                         List **opfamilies, List **opstrats);
48 extern bool ops_in_same_btree_opfamily(Oid opno1, Oid opno2);
49 extern Oid      get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype,
50                                                           int16 procnum);
51 extern char *get_attname(Oid relid, AttrNumber attnum);
52 extern char *get_relid_attribute_name(Oid relid, AttrNumber attnum);
53 extern AttrNumber get_attnum(Oid relid, const char *attname);
54 extern Oid      get_atttype(Oid relid, AttrNumber attnum);
55 extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
56 extern void get_atttypetypmod(Oid relid, AttrNumber attnum,
57                                   Oid *typid, int32 *typmod);
58 extern Oid      get_opclass_family(Oid opclass);
59 extern Oid      get_opclass_input_type(Oid opclass);
60 extern RegProcedure get_opcode(Oid opno);
61 extern char *get_opname(Oid opno);
62 extern void op_input_types(Oid opno, Oid *lefttype, Oid *righttype);
63 extern bool op_mergejoinable(Oid opno);
64 extern bool op_hashjoinable(Oid opno);
65 extern bool op_strict(Oid opno);
66 extern char op_volatile(Oid opno);
67 extern Oid      get_commutator(Oid opno);
68 extern Oid      get_negator(Oid opno);
69 extern RegProcedure get_oprrest(Oid opno);
70 extern RegProcedure get_oprjoin(Oid opno);
71 extern char *get_func_name(Oid funcid);
72 extern Oid      get_func_rettype(Oid funcid);
73 extern int      get_func_nargs(Oid funcid);
74 extern Oid      get_func_signature(Oid funcid, Oid **argtypes, int *nargs);
75 extern bool get_func_retset(Oid funcid);
76 extern bool func_strict(Oid funcid);
77 extern char func_volatile(Oid funcid);
78 extern Oid      get_relname_relid(const char *relname, Oid relnamespace);
79 extern char *get_rel_name(Oid relid);
80 extern Oid      get_rel_namespace(Oid relid);
81 extern Oid      get_rel_type_id(Oid relid);
82 extern char get_rel_relkind(Oid relid);
83 extern bool get_typisdefined(Oid typid);
84 extern int16 get_typlen(Oid typid);
85 extern bool get_typbyval(Oid typid);
86 extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
87 extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
88                                          char *typalign);
89 extern Oid      getTypeIOParam(HeapTuple typeTuple);
90 extern void get_type_io_data(Oid typid,
91                                  IOFuncSelector which_func,
92                                  int16 *typlen,
93                                  bool *typbyval,
94                                  char *typalign,
95                                  char *typdelim,
96                                  Oid *typioparam,
97                                  Oid *func);
98 extern char get_typstorage(Oid typid);
99 extern Node *get_typdefault(Oid typid);
100 extern char get_typtype(Oid typid);
101 extern bool type_is_rowtype(Oid typid);
102 extern Oid      get_typ_typrelid(Oid typid);
103 extern Oid      get_element_type(Oid typid);
104 extern Oid      get_array_type(Oid typid);
105 extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam);
106 extern void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena);
107 extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typIOParam);
108 extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, bool *typIsVarlena);
109 extern Oid      get_typmodin(Oid typid);
110 extern Oid      getBaseType(Oid typid);
111 extern Oid      getBaseTypeAndTypmod(Oid typid, int32 *typmod);
112 extern int32 get_typavgwidth(Oid typid, int32 typmod);
113 extern int32 get_attavgwidth(Oid relid, AttrNumber attnum);
114 extern bool get_attstatsslot(HeapTuple statstuple,
115                                  Oid atttype, int32 atttypmod,
116                                  int reqkind, Oid reqop,
117                                  Datum **values, int *nvalues,
118                                  float4 **numbers, int *nnumbers);
119 extern void free_attstatsslot(Oid atttype,
120                                   Datum *values, int nvalues,
121                                   float4 *numbers, int nnumbers);
122 extern char *get_namespace_name(Oid nspid);
123 extern Oid      get_roleid(const char *rolname);
124 extern Oid      get_roleid_checked(const char *rolname);
125
126 #define is_array_type(typid)  (get_element_type(typid) != InvalidOid)
127
128 #define TypeIsToastable(typid)  (get_typstorage(typid) != 'p')
129
130 #endif   /* LSYSCACHE_H */