1 /*-------------------------------------------------------------------------
4 * Convenience routines for common queries in the system catalog cache.
6 * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.85 2003/11/29 22:41:15 pgsql Exp $
11 *-------------------------------------------------------------------------
16 #include "access/htup.h"
18 /* I/O function selector for get_type_io_data */
19 typedef enum IOFuncSelector
27 extern bool op_in_opclass(Oid opno, Oid opclass);
28 extern void get_op_opclass_properties(Oid opno, Oid opclass,
29 int *strategy, Oid *subtype,
31 extern Oid get_opclass_member(Oid opclass, Oid subtype, int16 strategy);
32 extern Oid get_op_hash_function(Oid opno);
33 extern Oid get_opclass_proc(Oid opclass, Oid subtype, int16 procnum);
34 extern char *get_attname(Oid relid, AttrNumber attnum);
35 extern char *get_relid_attribute_name(Oid relid, AttrNumber attnum);
36 extern AttrNumber get_attnum(Oid relid, const char *attname);
37 extern Oid get_atttype(Oid relid, AttrNumber attnum);
38 extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
39 extern void get_atttypetypmod(Oid relid, AttrNumber attnum,
40 Oid *typid, int32 *typmod);
41 extern bool opclass_is_btree(Oid opclass);
42 extern bool opclass_is_hash(Oid opclass);
43 extern RegProcedure get_opcode(Oid opno);
44 extern char *get_opname(Oid opno);
45 extern bool op_mergejoinable(Oid opno, Oid *leftOp, Oid *rightOp);
46 extern void op_mergejoin_crossops(Oid opno, Oid *ltop, Oid *gtop,
47 RegProcedure *ltproc, RegProcedure *gtproc);
48 extern bool op_hashjoinable(Oid opno);
49 extern bool op_strict(Oid opno);
50 extern char op_volatile(Oid opno);
51 extern Oid get_commutator(Oid opno);
52 extern Oid get_negator(Oid opno);
53 extern RegProcedure get_oprrest(Oid opno);
54 extern RegProcedure get_oprjoin(Oid opno);
55 extern char *get_func_name(Oid funcid);
56 extern Oid get_func_rettype(Oid funcid);
57 extern Oid get_func_signature(Oid funcid, Oid *argtypes, int *nargs);
58 extern bool get_func_retset(Oid funcid);
59 extern bool func_strict(Oid funcid);
60 extern char func_volatile(Oid funcid);
61 extern Oid get_relname_relid(const char *relname, Oid relnamespace);
62 extern Oid get_system_catalog_relid(const char *catname);
63 extern char *get_rel_name(Oid relid);
64 extern Oid get_rel_namespace(Oid relid);
65 extern Oid get_rel_type_id(Oid relid);
66 extern char get_rel_relkind(Oid relid);
67 extern bool get_typisdefined(Oid typid);
68 extern int16 get_typlen(Oid typid);
69 extern bool get_typbyval(Oid typid);
70 extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
71 extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
73 extern void get_type_io_data(Oid typid,
74 IOFuncSelector which_func,
81 extern char get_typstorage(Oid typid);
82 extern int32 get_typtypmod(Oid typid);
83 extern Node *get_typdefault(Oid typid);
84 extern char get_typtype(Oid typid);
85 extern Oid get_typ_typrelid(Oid typid);
86 extern Oid get_element_type(Oid typid);
87 extern Oid get_array_type(Oid typid);
88 extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typElem);
89 extern void getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem,
91 extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typElem);
92 extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, Oid *typElem,
94 extern Oid getBaseType(Oid typid);
95 extern int32 get_typavgwidth(Oid typid, int32 typmod);
96 extern int32 get_attavgwidth(Oid relid, AttrNumber attnum);
97 extern bool get_attstatsslot(HeapTuple statstuple,
98 Oid atttype, int32 atttypmod,
99 int reqkind, Oid reqop,
100 Datum **values, int *nvalues,
101 float4 **numbers, int *nnumbers);
102 extern void free_attstatsslot(Oid atttype,
103 Datum *values, int nvalues,
104 float4 *numbers, int nnumbers);
105 extern char *get_namespace_name(Oid nspid);
106 extern int32 get_usesysid(const char *username);
108 #define is_array_type(typid) (get_element_type(typid) != InvalidOid)
110 #define TypeIsToastable(typid) (get_typstorage(typid) != 'p')
112 #endif /* LSYSCACHE_H */