1
/*-------------------------------------------------------------------------
4
* Type cache definitions.
6
* The type cache exists to speed lookup of certain information about data
7
* types that is not directly available from a type's pg_type row.
9
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
10
* Portions Copyright (c) 1994, Regents of the University of California
12
* $PostgreSQL: pgsql/src/include/utils/typcache.h,v 1.7 2004-12-31 22:03:46 pgsql Exp $
14
*-------------------------------------------------------------------------
19
#include "access/tupdesc.h"
23
typedef struct TypeCacheEntry
25
/* typeId is the hash lookup key and MUST BE FIRST */
26
Oid type_id; /* OID of the data type */
28
/* some subsidiary information copied from the pg_type row */
36
* Information obtained from opclass entries
38
* These will be InvalidOid if no match could be found, or if the
39
* information hasn't yet been requested.
41
Oid btree_opc; /* OID of the default btree opclass */
42
Oid hash_opc; /* OID of the default hash opclass */
43
Oid eq_opr; /* OID of the equality operator */
44
Oid lt_opr; /* OID of the less-than operator */
45
Oid gt_opr; /* OID of the greater-than operator */
46
Oid cmp_proc; /* OID of the btree comparison function */
49
* Pre-set-up fmgr call info for the equality operator and the btree
50
* comparison function. These are kept in the type cache to avoid
51
* problems with memory leaks in repeated calls to array_eq and
52
* array_cmp. There is not currently a need to maintain call info for
53
* the lt_opr or gt_opr.
55
FmgrInfo eq_opr_finfo;
56
FmgrInfo cmp_proc_finfo;
59
* Tuple descriptor if it's a composite type (row type). NULL if not
60
* composite or information hasn't yet been requested. (NOTE: this is
61
* actually just a link to information maintained by relcache.c.)
66
/* Bit flags to indicate which fields a given caller needs to have set */
67
#define TYPECACHE_EQ_OPR 0x0001
68
#define TYPECACHE_LT_OPR 0x0002
69
#define TYPECACHE_GT_OPR 0x0004
70
#define TYPECACHE_CMP_PROC 0x0008
71
#define TYPECACHE_EQ_OPR_FINFO 0x0010
72
#define TYPECACHE_CMP_PROC_FINFO 0x0020
73
#define TYPECACHE_TUPDESC 0x0040
75
extern TypeCacheEntry *lookup_type_cache(Oid type_id, int flags);
77
extern TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod);
79
extern TupleDesc lookup_rowtype_tupdesc_noerror(Oid type_id, int32 typmod,
82
extern void assign_record_type_typmod(TupleDesc tupDesc);
84
extern void flush_rowtype_cache(Oid type_id);
86
#endif /* TYPCACHE_H */