~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/include/utils/typcache.h

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-------------------------------------------------------------------------
 
2
 *
 
3
 * typcache.h
 
4
 *        Type cache definitions.
 
5
 *
 
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.
 
8
 *
 
9
 * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
 
10
 * Portions Copyright (c) 1994, Regents of the University of California
 
11
 *
 
12
 * $PostgreSQL: pgsql/src/include/utils/typcache.h,v 1.7 2004-12-31 22:03:46 pgsql Exp $
 
13
 *
 
14
 *-------------------------------------------------------------------------
 
15
 */
 
16
#ifndef TYPCACHE_H
 
17
#define TYPCACHE_H
 
18
 
 
19
#include "access/tupdesc.h"
 
20
#include "fmgr.h"
 
21
 
 
22
 
 
23
typedef struct TypeCacheEntry
 
24
{
 
25
        /* typeId is the hash lookup key and MUST BE FIRST */
 
26
        Oid                     type_id;                /* OID of the data type */
 
27
 
 
28
        /* some subsidiary information copied from the pg_type row */
 
29
        int16           typlen;
 
30
        bool            typbyval;
 
31
        char            typalign;
 
32
        char            typtype;
 
33
        Oid                     typrelid;
 
34
 
 
35
        /*
 
36
         * Information obtained from opclass entries
 
37
         *
 
38
         * These will be InvalidOid if no match could be found, or if the
 
39
         * information hasn't yet been requested.
 
40
         */
 
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 */
 
47
 
 
48
        /*
 
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.
 
54
         */
 
55
        FmgrInfo        eq_opr_finfo;
 
56
        FmgrInfo        cmp_proc_finfo;
 
57
 
 
58
        /*
 
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.)
 
62
         */
 
63
        TupleDesc       tupDesc;
 
64
} TypeCacheEntry;
 
65
 
 
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
 
74
 
 
75
extern TypeCacheEntry *lookup_type_cache(Oid type_id, int flags);
 
76
 
 
77
extern TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod);
 
78
 
 
79
extern TupleDesc lookup_rowtype_tupdesc_noerror(Oid type_id, int32 typmod,
 
80
                                                           bool noError);
 
81
 
 
82
extern void assign_record_type_typmod(TupleDesc tupDesc);
 
83
 
 
84
extern void flush_rowtype_cache(Oid type_id);
 
85
 
 
86
#endif   /* TYPCACHE_H */