PostgreSQL Source Code  git master
btree_utils_var.h
Go to the documentation of this file.
1 /*
2  * contrib/btree_gist/btree_utils_var.h
3  */
4 #ifndef __BTREE_UTILS_VAR_H__
5 #define __BTREE_UTILS_VAR_H__
6 
7 #include "access/gist.h"
8 #include "btree_gist.h"
9 #include "mb/pg_wchar.h"
10 
11 /* Variable length key */
12 typedef bytea GBT_VARKEY;
13 
14 /* Better readable key */
15 typedef struct
16 {
18  *upper;
19 } GBT_VARKEY_R;
20 
21 /*
22  * type description
23  */
24 typedef struct
25 {
26 
27  /* Attribs */
28 
29  enum gbtree_type t; /* data type */
30  int32 eml; /* cached pg_database_encoding_max_length (0:
31  * undefined) */
32  bool trnc; /* truncate (=compress) key */
33 
34  /* Methods */
35 
36  bool (*f_gt) (const void *, const void *, Oid, FmgrInfo *); /* greater than */
37  bool (*f_ge) (const void *, const void *, Oid, FmgrInfo *); /* greater equal */
38  bool (*f_eq) (const void *, const void *, Oid, FmgrInfo *); /* equal */
39  bool (*f_le) (const void *, const void *, Oid, FmgrInfo *); /* less equal */
40  bool (*f_lt) (const void *, const void *, Oid, FmgrInfo *); /* less than */
41  int32 (*f_cmp) (const void *, const void *, Oid, FmgrInfo *); /* compare */
42  GBT_VARKEY *(*f_l2n) (GBT_VARKEY *, FmgrInfo *flinfo); /* convert leaf to node */
43 } gbtree_vinfo;
44 
45 
46 
48 
49 extern GBT_VARKEY *gbt_var_key_copy(const GBT_VARKEY_R *u);
50 
51 extern GISTENTRY *gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo);
52 
53 extern GBT_VARKEY *gbt_var_union(const GistEntryVector *entryvec, int32 *size,
54  Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
55 
56 extern bool gbt_var_same(Datum d1, Datum d2, Oid collation,
57  const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
58 
59 extern float *gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
60  Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
61 
62 extern bool gbt_var_consistent(GBT_VARKEY_R *key, const void *query,
63  StrategyNumber strategy, Oid collation, bool is_leaf,
64  const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
65 
67  Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
68 
69 extern void gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation,
70  const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
71 
72 #endif
Definition: fmgr.h:56
gbtree_type
Definition: btree_gist.h:14
GBT_VARKEY_R gbt_var_key_readable(const GBT_VARKEY *k)
Datum lower(PG_FUNCTION_ARGS)
Definition: oracle_compat.c:43
bool gbt_var_same(Datum d1, Datum d2, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
uint16 StrategyNumber
Definition: stratnum.h:22
bytea GBT_VARKEY
unsigned int Oid
Definition: postgres_ext.h:31
float * gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
signed int int32
Definition: c.h:347
void gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
GIST_SPLITVEC * gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
GISTENTRY * gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo)
uintptr_t Datum
Definition: postgres.h:367
bool gbt_var_consistent(GBT_VARKEY_R *key, const void *query, StrategyNumber strategy, Oid collation, bool is_leaf, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
static const gbtree_vinfo tinfo
Definition: btree_bit.c:110
GBT_VARKEY * gbt_var_key_copy(const GBT_VARKEY_R *u)
e
Definition: preproc-init.c:82
Definition: c.h:556
GBT_VARKEY * gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
unsigned char bool
Definition: c.h:309