1 /*-------------------------------------------------------------------------
4 * Convenience routines for common queries in the system catalog cache.
6 * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * $Id: lsyscache.h,v 1.74 2003/06/25 21:30:33 momjian Exp $
11 *-------------------------------------------------------------------------
16 #include "access/htup.h"
18 extern bool op_in_opclass(Oid opno, Oid opclass);
19 extern bool op_requires_recheck(Oid opno, Oid opclass);
20 extern Oid get_opclass_member(Oid opclass, int16 strategy);
21 extern Oid get_op_hash_function(Oid opno);
22 extern char *get_attname(Oid relid, AttrNumber attnum);
23 extern AttrNumber get_attnum(Oid relid, const char *attname);
24 extern Oid get_atttype(Oid relid, AttrNumber attnum);
25 extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
26 extern void get_atttypetypmod(Oid relid, AttrNumber attnum,
27 Oid *typid, int32 *typmod);
28 extern bool opclass_is_btree(Oid opclass);
29 extern bool opclass_is_hash(Oid opclass);
30 extern RegProcedure get_opcode(Oid opno);
31 extern char *get_opname(Oid opno);
32 extern bool op_mergejoinable(Oid opno, Oid *leftOp, Oid *rightOp);
33 extern void op_mergejoin_crossops(Oid opno, Oid *ltop, Oid *gtop,
34 RegProcedure *ltproc, RegProcedure *gtproc);
35 extern bool op_hashjoinable(Oid opno);
36 extern bool op_strict(Oid opno);
37 extern char op_volatile(Oid opno);
38 extern Oid get_commutator(Oid opno);
39 extern Oid get_negator(Oid opno);
40 extern RegProcedure get_oprrest(Oid opno);
41 extern RegProcedure get_oprjoin(Oid opno);
42 extern char *get_func_name(Oid funcid);
43 extern Oid get_func_rettype(Oid funcid);
44 extern bool get_func_retset(Oid funcid);
45 extern bool func_strict(Oid funcid);
46 extern char func_volatile(Oid funcid);
47 extern Oid get_relname_relid(const char *relname, Oid relnamespace);
48 extern Oid get_system_catalog_relid(const char *catname);
49 extern char *get_rel_name(Oid relid);
50 extern Oid get_rel_namespace(Oid relid);
51 extern Oid get_rel_type_id(Oid relid);
52 extern char get_rel_relkind(Oid relid);
53 extern bool get_typisdefined(Oid typid);
54 extern int16 get_typlen(Oid typid);
55 extern bool get_typbyval(Oid typid);
56 extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
57 extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
59 extern char get_typstorage(Oid typid);
60 extern int32 get_typtypmod(Oid typid);
61 extern Node *get_typdefault(Oid typid);
62 extern char get_typtype(Oid typid);
63 extern Oid get_typ_typrelid(Oid typid);
64 extern Oid get_element_type(Oid typid);
65 extern Oid get_array_type(Oid typid);
66 extern char *get_typname(Oid relid);
67 extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typElem);
68 extern void getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem,
70 extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typElem);
71 extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, Oid *typElem,
73 extern Oid getBaseType(Oid typid);
74 extern int32 get_typavgwidth(Oid typid, int32 typmod);
75 extern int32 get_attavgwidth(Oid relid, AttrNumber attnum);
76 extern bool get_attstatsslot(HeapTuple statstuple,
77 Oid atttype, int32 atttypmod,
78 int reqkind, Oid reqop,
79 Datum **values, int *nvalues,
80 float4 **numbers, int *nnumbers);
81 extern void free_attstatsslot(Oid atttype,
82 Datum *values, int nvalues,
83 float4 *numbers, int nnumbers);
84 extern char *get_namespace_name(Oid nspid);
85 extern int32 get_usesysid(const char *username);
87 #define is_array_type(typid) (get_element_type(typid) != InvalidOid)
89 #define TypeIsToastable(typid) (get_typstorage(typid) != 'p')
91 #endif /* LSYSCACHE_H */