Header And Logo

PostgreSQL
| The world's most advanced open source database.

btree_utils_var.h

Go to the documentation of this file.
00001 /*
00002  * contrib/btree_gist/btree_utils_var.h
00003  */
00004 #ifndef __BTREE_UTILS_VAR_H__
00005 #define __BTREE_UTILS_VAR_H__
00006 
00007 #include "btree_gist.h"
00008 
00009 #include "access/gist.h"
00010 #include "mb/pg_wchar.h"
00011 
00012 /* Variable length key */
00013 typedef bytea GBT_VARKEY;
00014 
00015 /* Better readable key */
00016 typedef struct
00017 {
00018     bytea      *lower,
00019                *upper;
00020 } GBT_VARKEY_R;
00021 
00022 /*
00023  * type description
00024  */
00025 typedef struct
00026 {
00027 
00028     /* Attribs */
00029 
00030     enum gbtree_type t;         /* data type */
00031     int32       eml;            /* cached pg_database_encoding_max_length (0:
00032                                  * undefined) */
00033     bool        trnc;           /* truncate (=compress) key */
00034 
00035     /* Methods */
00036 
00037     bool        (*f_gt) (const void *, const void *, Oid);      /* greater than */
00038     bool        (*f_ge) (const void *, const void *, Oid);      /* greater equal */
00039     bool        (*f_eq) (const void *, const void *, Oid);      /* equal */
00040     bool        (*f_le) (const void *, const void *, Oid);      /* less equal */
00041     bool        (*f_lt) (const void *, const void *, Oid);      /* less than */
00042     int32       (*f_cmp) (const void *, const void *, Oid);     /* compare */
00043     GBT_VARKEY *(*f_l2n) (GBT_VARKEY *);        /* convert leaf to node */
00044 } gbtree_vinfo;
00045 
00046 
00047 
00048 extern GBT_VARKEY_R gbt_var_key_readable(const GBT_VARKEY *k);
00049 
00050 extern GBT_VARKEY *gbt_var_key_copy(const GBT_VARKEY_R *u, bool force_node);
00051 
00052 extern GISTENTRY *gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo);
00053 
00054 extern GBT_VARKEY *gbt_var_union(const GistEntryVector *entryvec, int32 *size,
00055               Oid collation, const gbtree_vinfo *tinfo);
00056 
00057 extern bool gbt_var_same(Datum d1, Datum d2, Oid collation,
00058              const gbtree_vinfo *tinfo);
00059 
00060 extern float *gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
00061                 Oid collation, const gbtree_vinfo *tinfo);
00062 
00063 extern bool gbt_var_consistent(GBT_VARKEY_R *key, const void *query,
00064                    StrategyNumber strategy, Oid collation, bool is_leaf,
00065                    const gbtree_vinfo *tinfo);
00066 
00067 extern GIST_SPLITVEC *gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
00068                   Oid collation, const gbtree_vinfo *tinfo);
00069 
00070 extern void gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation,
00071                   const gbtree_vinfo *tinfo);
00072 
00073 #endif