PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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 "btree_gist.h"
8 
9 #include "access/gist.h"
10 #include "mb/pg_wchar.h"
11 
12 /* Variable length key */
13 typedef bytea GBT_VARKEY;
14 
15 /* Better readable key */
16 typedef struct
17 {
19  *upper;
20 } GBT_VARKEY_R;
21 
22 /*
23  * type description
24  */
25 typedef struct
26 {
27 
28  /* Attribs */
29 
30  enum gbtree_type t; /* data type */
31  int32 eml; /* cached pg_database_encoding_max_length (0:
32  * undefined) */
33  bool trnc; /* truncate (=compress) key */
34 
35  /* Methods */
36 
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 */
44 } gbtree_vinfo;
45 
46 
47 
49 
50 extern GBT_VARKEY *gbt_var_key_copy(const GBT_VARKEY_R *u);
51 
52 extern GISTENTRY *gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo);
53 
54 extern GBT_VARKEY *gbt_var_union(const GistEntryVector *entryvec, int32 *size,
55  Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
56 
57 extern bool gbt_var_same(Datum d1, Datum d2, Oid collation,
58  const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
59 
60 extern float *gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n,
61  Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
62 
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);
66 
68  Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
69 
70 extern void gbt_var_bin_union(Datum *u, GBT_VARKEY *e, Oid collation,
71  const gbtree_vinfo *tinfo, FmgrInfo *flinfo);
72 
73 #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)
char bool
Definition: c.h:202
signed int int32
Definition: c.h:256
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:372
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:439
GBT_VARKEY * gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)