mirror of
https://github.com/postgres/postgres.git
synced 2026-03-09 01:31:22 -04:00
cases. Operator classes now exist within "operator families". While most families are equivalent to a single class, related classes can be grouped into one family to represent the fact that they are semantically compatible. Cross-type operators are now naturally adjunct parts of a family, without having to wedge them into a particular opclass as we had done originally. This commit restructures the catalogs and cleans up enough of the fallout so that everything still works at least as well as before, but most of the work needed to actually improve the planner's behavior will come later. Also, there are not yet CREATE/DROP/ALTER OPERATOR FAMILY commands; the only way to create a new family right now is to allow CREATE OPERATOR CLASS to make one by default. I owe some more documentation work, too. But that can all be done in smaller pieces once this infrastructure is in place.
91 lines
2.9 KiB
C
91 lines
2.9 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* typcache.h
|
|
* Type cache definitions.
|
|
*
|
|
* The type cache exists to speed lookup of certain information about data
|
|
* types that is not directly available from a type's pg_type row.
|
|
*
|
|
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* $PostgreSQL: pgsql/src/include/utils/typcache.h,v 1.13 2006/12/23 00:43:13 tgl Exp $
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef TYPCACHE_H
|
|
#define TYPCACHE_H
|
|
|
|
#include "access/tupdesc.h"
|
|
#include "fmgr.h"
|
|
|
|
|
|
typedef struct TypeCacheEntry
|
|
{
|
|
/* typeId is the hash lookup key and MUST BE FIRST */
|
|
Oid type_id; /* OID of the data type */
|
|
|
|
/* some subsidiary information copied from the pg_type row */
|
|
int16 typlen;
|
|
bool typbyval;
|
|
char typalign;
|
|
char typtype;
|
|
Oid typrelid;
|
|
|
|
/*
|
|
* Information obtained from opfamily entries
|
|
*
|
|
* These will be InvalidOid if no match could be found, or if the
|
|
* information hasn't yet been requested.
|
|
*/
|
|
Oid btree_opf; /* the default btree opclass' family */
|
|
Oid btree_opintype; /* the default btree opclass' opcintype */
|
|
Oid hash_opf; /* the default hash opclass' family */
|
|
Oid hash_opintype; /* the default hash opclass' opcintype */
|
|
Oid eq_opr; /* the equality operator */
|
|
Oid lt_opr; /* the less-than operator */
|
|
Oid gt_opr; /* the greater-than operator */
|
|
Oid cmp_proc; /* the btree comparison function */
|
|
|
|
/*
|
|
* Pre-set-up fmgr call info for the equality operator and the btree
|
|
* comparison function. These are kept in the type cache to avoid
|
|
* problems with memory leaks in repeated calls to array_eq and array_cmp.
|
|
* There is not currently a need to maintain call info for the lt_opr or
|
|
* gt_opr.
|
|
*/
|
|
FmgrInfo eq_opr_finfo;
|
|
FmgrInfo cmp_proc_finfo;
|
|
|
|
/*
|
|
* Tuple descriptor if it's a composite type (row type). NULL if not
|
|
* composite or information hasn't yet been requested. (NOTE: this is a
|
|
* reference-counted tupledesc.)
|
|
*/
|
|
TupleDesc tupDesc;
|
|
} TypeCacheEntry;
|
|
|
|
/* Bit flags to indicate which fields a given caller needs to have set */
|
|
#define TYPECACHE_EQ_OPR 0x0001
|
|
#define TYPECACHE_LT_OPR 0x0002
|
|
#define TYPECACHE_GT_OPR 0x0004
|
|
#define TYPECACHE_CMP_PROC 0x0008
|
|
#define TYPECACHE_EQ_OPR_FINFO 0x0010
|
|
#define TYPECACHE_CMP_PROC_FINFO 0x0020
|
|
#define TYPECACHE_TUPDESC 0x0040
|
|
#define TYPECACHE_BTREE_OPFAMILY 0x0080
|
|
|
|
extern TypeCacheEntry *lookup_type_cache(Oid type_id, int flags);
|
|
|
|
extern TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod);
|
|
|
|
extern TupleDesc lookup_rowtype_tupdesc_noerror(Oid type_id, int32 typmod,
|
|
bool noError);
|
|
|
|
extern TupleDesc lookup_rowtype_tupdesc_copy(Oid type_id, int32 typmod);
|
|
|
|
extern void assign_record_type_typmod(TupleDesc tupDesc);
|
|
|
|
extern void flush_rowtype_cache(Oid type_id);
|
|
|
|
#endif /* TYPCACHE_H */
|