]> granicus.if.org Git - postgresql/blob - src/include/utils/lsyscache.h
Create a 'type cache' that keeps track of the data needed for any particular
[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-2003, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * $Id: lsyscache.h,v 1.81 2003/08/17 19:58:06 tgl Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef LSYSCACHE_H
14 #define LSYSCACHE_H
15
16 #include "access/htup.h"
17
18 /* I/O function selector for get_type_io_data */
19 typedef enum IOFuncSelector
20 {
21         IOFunc_input,
22         IOFunc_output,
23         IOFunc_receive,
24         IOFunc_send
25 } IOFuncSelector;
26
27 extern bool op_in_opclass(Oid opno, Oid opclass);
28 extern bool op_requires_recheck(Oid opno, Oid opclass);
29 extern Oid      get_opclass_member(Oid opclass, int16 strategy);
30 extern Oid      get_op_hash_function(Oid opno);
31 extern Oid      get_opclass_proc(Oid opclass, int16 procnum);
32 extern char *get_attname(Oid relid, AttrNumber attnum);
33 extern char *get_relid_attribute_name(Oid relid, AttrNumber attnum);
34 extern AttrNumber get_attnum(Oid relid, const char *attname);
35 extern Oid      get_atttype(Oid relid, AttrNumber attnum);
36 extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
37 extern void get_atttypetypmod(Oid relid, AttrNumber attnum,
38                                   Oid *typid, int32 *typmod);
39 extern bool opclass_is_btree(Oid opclass);
40 extern bool opclass_is_hash(Oid opclass);
41 extern RegProcedure get_opcode(Oid opno);
42 extern char *get_opname(Oid opno);
43 extern bool op_mergejoinable(Oid opno, Oid *leftOp, Oid *rightOp);
44 extern void op_mergejoin_crossops(Oid opno, Oid *ltop, Oid *gtop,
45                                           RegProcedure *ltproc, RegProcedure *gtproc);
46 extern bool op_hashjoinable(Oid opno);
47 extern bool op_strict(Oid opno);
48 extern char op_volatile(Oid opno);
49 extern Oid      get_commutator(Oid opno);
50 extern Oid      get_negator(Oid opno);
51 extern RegProcedure get_oprrest(Oid opno);
52 extern RegProcedure get_oprjoin(Oid opno);
53 extern char *get_func_name(Oid funcid);
54 extern Oid      get_func_rettype(Oid funcid);
55 extern Oid      get_func_signature(Oid funcid, Oid *argtypes, int *nargs);
56 extern bool get_func_retset(Oid funcid);
57 extern bool func_strict(Oid funcid);
58 extern char func_volatile(Oid funcid);
59 extern Oid      get_relname_relid(const char *relname, Oid relnamespace);
60 extern Oid      get_system_catalog_relid(const char *catname);
61 extern char *get_rel_name(Oid relid);
62 extern Oid      get_rel_namespace(Oid relid);
63 extern Oid      get_rel_type_id(Oid relid);
64 extern char get_rel_relkind(Oid relid);
65 extern bool get_typisdefined(Oid typid);
66 extern int16 get_typlen(Oid typid);
67 extern bool get_typbyval(Oid typid);
68 extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
69 extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
70                                          char *typalign);
71 extern void get_type_io_data(Oid typid,
72                                  IOFuncSelector which_func,
73                                  int16 *typlen,
74                                  bool *typbyval,
75                                  char *typalign,
76                                  char *typdelim,
77                                  Oid *typelem,
78                                  Oid *func);
79 extern char get_typstorage(Oid typid);
80 extern int32 get_typtypmod(Oid typid);
81 extern Node *get_typdefault(Oid typid);
82 extern char get_typtype(Oid typid);
83 extern Oid      get_typ_typrelid(Oid typid);
84 extern Oid      get_element_type(Oid typid);
85 extern Oid      get_array_type(Oid typid);
86 extern char *get_typname(Oid relid);
87 extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typElem);
88 extern void getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem,
89                                   bool *typIsVarlena);
90 extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typElem);
91 extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, Oid *typElem,
92                                                 bool *typIsVarlena);
93 extern Oid      getBaseType(Oid typid);
94 extern int32 get_typavgwidth(Oid typid, int32 typmod);
95 extern int32 get_attavgwidth(Oid relid, AttrNumber attnum);
96 extern bool get_attstatsslot(HeapTuple statstuple,
97                                  Oid atttype, int32 atttypmod,
98                                  int reqkind, Oid reqop,
99                                  Datum **values, int *nvalues,
100                                  float4 **numbers, int *nnumbers);
101 extern void free_attstatsslot(Oid atttype,
102                                   Datum *values, int nvalues,
103                                   float4 *numbers, int nnumbers);
104 extern char *get_namespace_name(Oid nspid);
105 extern int32 get_usesysid(const char *username);
106
107 #define is_array_type(typid)  (get_element_type(typid) != InvalidOid)
108
109 #define TypeIsToastable(typid)  (get_typstorage(typid) != 'p')
110
111 #endif   /* LSYSCACHE_H */