2 * contrib/btree_gist/btree_utils_var.h
4 #ifndef __BTREE_UTILS_VAR_H__
5 #define __BTREE_UTILS_VAR_H__
7 #include "btree_gist.h"
9 #include "access/gist.h"
10 #include "mb/pg_wchar.h"
12 /* Variable length key */
13 typedef bytea GBT_VARKEY;
15 /* Better readable key */
30 enum gbtree_type t; /* data type */
31 int32 eml; /* cached pg_database_encoding_max_length (0:
33 bool trnc; /* truncate (=compress) key */
37 bool (*f_gt) (const void *, const void *, Oid, FmgrInfo *); /* greater than */
38 bool (*f_ge) (const void *, const void *, Oid, FmgrInfo *); /* greater equal */
39 bool (*f_eq) (const void *, const void *, Oid, FmgrInfo *); /* equal */
40 bool (*f_le) (const void *, const void *, Oid, FmgrInfo *); /* less equal */
41 bool (*f_lt) (const void *, const void *, Oid, FmgrInfo *); /* less than */
42 int32 (*f_cmp) (const void *, const void *, Oid, FmgrInfo *); /* compare */
43 GBT_VARKEY *(*f_l2n) (GBT_VARKEY *, FmgrInfo *flinfo); /* convert leaf to node */
48 extern GBT_VARKEY_R gbt_var_key_readable(const GBT_VARKEY *k);
50 extern GBT_VARKEY *gbt_var_key_copy(const GBT_VARKEY_R *u);
52 extern GISTENTRY *gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo);
54 extern GBT_VARKEY *gbt_var_union(const GistEntryVector *entryvec, int32 *size,
55 Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
57 extern bool gbt_var_same(Datum d1, Datum d2, Oid collation,
58 const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
60 extern float *gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
61 Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
63 extern bool gbt_var_consistent(GBT_VARKEY_R *key, const void *query,
64 StrategyNumber strategy, Oid collation, bool is_leaf,
65 const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
67 extern GIST_SPLITVEC *gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v,
68 Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
70 extern void gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation,
71 const gbtree_vinfo *tinfo, FmgrInfo *flinfo);