]> granicus.if.org Git - postgresql/blob - src/include/utils/lsyscache.h
Rewriter and planner should use only resno, not resname, to identify
[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.80 2003/08/11 23:04:50 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 char *get_attname(Oid relid, AttrNumber attnum);
32 extern char *get_relid_attribute_name(Oid relid, AttrNumber attnum);
33 extern AttrNumber get_attnum(Oid relid, const char *attname);
34 extern Oid      get_atttype(Oid relid, AttrNumber attnum);
35 extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
36 extern void get_atttypetypmod(Oid relid, AttrNumber attnum,
37                                   Oid *typid, int32 *typmod);
38 extern bool opclass_is_btree(Oid opclass);
39 extern bool opclass_is_hash(Oid opclass);
40 extern RegProcedure get_opcode(Oid opno);
41 extern char *get_opname(Oid opno);
42 extern bool op_mergejoinable(Oid opno, Oid *leftOp, Oid *rightOp);
43 extern void op_mergejoin_crossops(Oid opno, Oid *ltop, Oid *gtop,
44                                           RegProcedure *ltproc, RegProcedure *gtproc);
45 extern bool op_hashjoinable(Oid opno);
46 extern bool op_strict(Oid opno);
47 extern char op_volatile(Oid opno);
48 extern Oid      get_commutator(Oid opno);
49 extern Oid      get_negator(Oid opno);
50 extern RegProcedure get_oprrest(Oid opno);
51 extern RegProcedure get_oprjoin(Oid opno);
52 extern char *get_func_name(Oid funcid);
53 extern Oid      get_func_rettype(Oid funcid);
54 extern Oid      get_func_signature(Oid funcid, Oid *argtypes, int *nargs);
55 extern bool get_func_retset(Oid funcid);
56 extern bool func_strict(Oid funcid);
57 extern char func_volatile(Oid funcid);
58 extern Oid      get_relname_relid(const char *relname, Oid relnamespace);
59 extern Oid      get_system_catalog_relid(const char *catname);
60 extern char *get_rel_name(Oid relid);
61 extern Oid      get_rel_namespace(Oid relid);
62 extern Oid      get_rel_type_id(Oid relid);
63 extern char get_rel_relkind(Oid relid);
64 extern bool get_typisdefined(Oid typid);
65 extern int16 get_typlen(Oid typid);
66 extern bool get_typbyval(Oid typid);
67 extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
68 extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
69                                          char *typalign);
70 extern void get_type_io_data(Oid typid,
71                                  IOFuncSelector which_func,
72                                  int16 *typlen,
73                                  bool *typbyval,
74                                  char *typalign,
75                                  char *typdelim,
76                                  Oid *typelem,
77                                  Oid *func);
78 extern char get_typstorage(Oid typid);
79 extern int32 get_typtypmod(Oid typid);
80 extern Node *get_typdefault(Oid typid);
81 extern char get_typtype(Oid typid);
82 extern Oid      get_typ_typrelid(Oid typid);
83 extern Oid      get_element_type(Oid typid);
84 extern Oid      get_array_type(Oid typid);
85 extern char *get_typname(Oid relid);
86 extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typElem);
87 extern void getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem,
88                                   bool *typIsVarlena);
89 extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typElem);
90 extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, Oid *typElem,
91                                                 bool *typIsVarlena);
92 extern Oid      getBaseType(Oid typid);
93 extern int32 get_typavgwidth(Oid typid, int32 typmod);
94 extern int32 get_attavgwidth(Oid relid, AttrNumber attnum);
95 extern bool get_attstatsslot(HeapTuple statstuple,
96                                  Oid atttype, int32 atttypmod,
97                                  int reqkind, Oid reqop,
98                                  Datum **values, int *nvalues,
99                                  float4 **numbers, int *nnumbers);
100 extern void free_attstatsslot(Oid atttype,
101                                   Datum *values, int nvalues,
102                                   float4 *numbers, int nnumbers);
103 extern char *get_namespace_name(Oid nspid);
104 extern int32 get_usesysid(const char *username);
105
106 #define is_array_type(typid)  (get_element_type(typid) != InvalidOid)
107
108 #define TypeIsToastable(typid)  (get_typstorage(typid) != 'p')
109
110 #endif   /* LSYSCACHE_H */