1 /*-------------------------------------------------------------------------
4 * Convenience routines for common queries in the system catalog cache.
6 * Portions Copyright (c) 1996-2005, 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.93 2004/12/31 22:03:46 pgsql Exp $
11 *-------------------------------------------------------------------------
16 #include "access/htup.h"
18 /* I/O function selector for get_type_io_data */
19 typedef enum IOFuncSelector
27 /* Type categories for get_type_func_class */
28 typedef enum TypeFuncClass
36 extern bool op_in_opclass(Oid opno, Oid opclass);
37 extern void get_op_opclass_properties(Oid opno, Oid opclass,
38 int *strategy, Oid *subtype,
40 extern Oid get_opclass_member(Oid opclass, Oid subtype, int16 strategy);
41 extern Oid get_op_hash_function(Oid opno);
42 extern Oid get_opclass_proc(Oid opclass, Oid subtype, int16 procnum);
43 extern char *get_attname(Oid relid, AttrNumber attnum);
44 extern char *get_relid_attribute_name(Oid relid, AttrNumber attnum);
45 extern AttrNumber get_attnum(Oid relid, const char *attname);
46 extern Oid get_atttype(Oid relid, AttrNumber attnum);
47 extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
48 extern void get_atttypetypmod(Oid relid, AttrNumber attnum,
49 Oid *typid, int32 *typmod);
50 extern bool opclass_is_btree(Oid opclass);
51 extern bool opclass_is_hash(Oid opclass);
52 extern RegProcedure get_opcode(Oid opno);
53 extern char *get_opname(Oid opno);
54 extern void op_input_types(Oid opno, Oid *lefttype, Oid *righttype);
55 extern bool op_mergejoinable(Oid opno, Oid *leftOp, Oid *rightOp);
56 extern void op_mergejoin_crossops(Oid opno, Oid *ltop, Oid *gtop,
57 RegProcedure *ltproc, RegProcedure *gtproc);
58 extern bool op_hashjoinable(Oid opno);
59 extern bool op_strict(Oid opno);
60 extern char op_volatile(Oid opno);
61 extern Oid get_commutator(Oid opno);
62 extern Oid get_negator(Oid opno);
63 extern RegProcedure get_oprrest(Oid opno);
64 extern RegProcedure get_oprjoin(Oid opno);
65 extern char *get_func_name(Oid funcid);
66 extern Oid get_func_rettype(Oid funcid);
67 extern Oid get_func_signature(Oid funcid, Oid *argtypes, int *nargs);
68 extern bool get_func_retset(Oid funcid);
69 extern bool func_strict(Oid funcid);
70 extern char func_volatile(Oid funcid);
71 extern Oid get_relname_relid(const char *relname, Oid relnamespace);
72 extern Oid get_system_catalog_relid(const char *catname);
73 extern char *get_rel_name(Oid relid);
74 extern Oid get_rel_namespace(Oid relid);
75 extern Oid get_rel_type_id(Oid relid);
76 extern char get_rel_relkind(Oid relid);
77 extern bool get_typisdefined(Oid typid);
78 extern int16 get_typlen(Oid typid);
79 extern bool get_typbyval(Oid typid);
80 extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
81 extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
83 extern Oid getTypeIOParam(HeapTuple typeTuple);
84 extern void get_type_io_data(Oid typid,
85 IOFuncSelector which_func,
92 extern char get_typstorage(Oid typid);
93 extern int32 get_typtypmod(Oid typid);
94 extern Node *get_typdefault(Oid typid);
95 extern char get_typtype(Oid typid);
96 extern TypeFuncClass get_type_func_class(Oid typid);
97 extern Oid get_typ_typrelid(Oid typid);
98 extern Oid get_element_type(Oid typid);
99 extern Oid get_array_type(Oid typid);
100 extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam);
101 extern void getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typIOParam,
103 extern void getTypeBinaryInputInfo(Oid type, Oid *typReceive, Oid *typIOParam);
104 extern void getTypeBinaryOutputInfo(Oid type, Oid *typSend, Oid *typIOParam,
106 extern Oid getBaseType(Oid typid);
107 extern int32 get_typavgwidth(Oid typid, int32 typmod);
108 extern int32 get_attavgwidth(Oid relid, AttrNumber attnum);
109 extern bool get_attstatsslot(HeapTuple statstuple,
110 Oid atttype, int32 atttypmod,
111 int reqkind, Oid reqop,
112 Datum **values, int *nvalues,
113 float4 **numbers, int *nnumbers);
114 extern void free_attstatsslot(Oid atttype,
115 Datum *values, int nvalues,
116 float4 *numbers, int nnumbers);
117 extern char *get_namespace_name(Oid nspid);
118 extern int32 get_usesysid(const char *username);
120 #define is_array_type(typid) (get_element_type(typid) != InvalidOid)
122 #define TypeIsToastable(typid) (get_typstorage(typid) != 'p')
124 #endif /* LSYSCACHE_H */