]> granicus.if.org Git - postgresql/blob - src/include/utils/lsyscache.h
Implement new-protocol binary I/O support in DataRow, Bind, and FunctionCall
[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-2002, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * $Id: lsyscache.h,v 1.69 2003/05/09 18:08:48 tgl Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef LSYSCACHE_H
14 #define LSYSCACHE_H
15
16 #include "access/htup.h"
17
18 extern bool op_in_opclass(Oid opno, Oid opclass);
19 extern bool op_requires_recheck(Oid opno, Oid opclass);
20 extern char *get_attname(Oid relid, AttrNumber attnum);
21 extern AttrNumber get_attnum(Oid relid, const char *attname);
22 extern Oid      get_atttype(Oid relid, AttrNumber attnum);
23 extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
24 extern void get_atttypetypmod(Oid relid, AttrNumber attnum,
25                                   Oid *typid, int32 *typmod);
26 extern bool opclass_is_btree(Oid opclass);
27 extern RegProcedure get_opcode(Oid opno);
28 extern char *get_opname(Oid opno);
29 extern bool op_mergejoinable(Oid opno, Oid *leftOp, Oid *rightOp);
30 extern void op_mergejoin_crossops(Oid opno, Oid *ltop, Oid *gtop,
31                                           RegProcedure *ltproc, RegProcedure *gtproc);
32 extern bool op_hashjoinable(Oid opno);
33 extern bool op_strict(Oid opno);
34 extern char op_volatile(Oid opno);
35 extern Oid      get_commutator(Oid opno);
36 extern Oid      get_negator(Oid opno);
37 extern RegProcedure get_oprrest(Oid opno);
38 extern RegProcedure get_oprjoin(Oid opno);
39 extern char *get_func_name(Oid funcid);
40 extern Oid      get_func_rettype(Oid funcid);
41 extern bool get_func_retset(Oid funcid);
42 extern bool func_strict(Oid funcid);
43 extern char func_volatile(Oid funcid);
44 extern Oid      get_relname_relid(const char *relname, Oid relnamespace);
45 extern Oid      get_system_catalog_relid(const char *catname);
46 extern char *get_rel_name(Oid relid);
47 extern Oid      get_rel_namespace(Oid relid);
48 extern Oid      get_rel_type_id(Oid relid);
49 extern char get_rel_relkind(Oid relid);
50 extern bool get_typisdefined(Oid typid);
51 extern int16 get_typlen(Oid typid);
52 extern bool get_typbyval(Oid typid);
53 extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
54 extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
55                                          char *typalign);
56 extern char get_typstorage(Oid typid);
57 extern int32 get_typtypmod(Oid typid);
58 extern Node *get_typdefault(Oid typid);
59 extern char get_typtype(Oid typid);
60 extern Oid      get_typ_typrelid(Oid typid);
61 extern Oid      get_element_type(Oid typid);
62 extern Oid      get_array_type(Oid typid);
63 extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typElem);
64 extern void getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem,
65                                   bool *typIsVarlena);
66 extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typElem);
67 extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, Oid *typElem,
68                                                                         bool *typIsVarlena);
69 extern Oid      getBaseType(Oid typid);
70 extern int32 get_typavgwidth(Oid typid, int32 typmod);
71 extern int32 get_attavgwidth(Oid relid, AttrNumber attnum);
72 extern bool get_attstatsslot(HeapTuple statstuple,
73                                  Oid atttype, int32 atttypmod,
74                                  int reqkind, Oid reqop,
75                                  Datum **values, int *nvalues,
76                                  float4 **numbers, int *nnumbers);
77 extern void free_attstatsslot(Oid atttype,
78                                   Datum *values, int nvalues,
79                                   float4 *numbers, int nnumbers);
80 extern char *get_namespace_name(Oid nspid);
81 extern int32 get_usesysid(const char *username);
82
83 #define is_array_type(typid)  (get_element_type(typid) != InvalidOid)
84
85 #define TypeIsToastable(typid)  (get_typstorage(typid) != 'p')
86
87 #endif   /* LSYSCACHE_H */