PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
btree_bytea.c File Reference
#include "postgres.h"
#include "btree_gist.h"
#include "btree_utils_var.h"
#include "utils/builtins.h"
#include "utils/bytea.h"
Include dependency graph for btree_bytea.c:

Go to the source code of this file.

Functions

 PG_FUNCTION_INFO_V1 (gbt_bytea_compress)
 
 PG_FUNCTION_INFO_V1 (gbt_bytea_union)
 
 PG_FUNCTION_INFO_V1 (gbt_bytea_picksplit)
 
 PG_FUNCTION_INFO_V1 (gbt_bytea_consistent)
 
 PG_FUNCTION_INFO_V1 (gbt_bytea_penalty)
 
 PG_FUNCTION_INFO_V1 (gbt_bytea_same)
 
static bool gbt_byteagt (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_byteage (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_byteaeq (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_byteale (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_bytealt (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static int32 gbt_byteacmp (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
Datum gbt_bytea_compress (PG_FUNCTION_ARGS)
 
Datum gbt_bytea_consistent (PG_FUNCTION_ARGS)
 
Datum gbt_bytea_union (PG_FUNCTION_ARGS)
 
Datum gbt_bytea_picksplit (PG_FUNCTION_ARGS)
 
Datum gbt_bytea_same (PG_FUNCTION_ARGS)
 
Datum gbt_bytea_penalty (PG_FUNCTION_ARGS)
 

Variables

static const gbtree_vinfo tinfo
 

Function Documentation

Datum gbt_bytea_compress ( PG_FUNCTION_ARGS  )

Definition at line 95 of file btree_bytea.c.

References gbt_var_compress(), PG_GETARG_POINTER, and PG_RETURN_POINTER.

96 {
97  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
98 
100 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
static const gbtree_vinfo tinfo
Definition: btree_bytea.c:74
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
GISTENTRY * gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo)
Datum gbt_bytea_consistent ( PG_FUNCTION_ARGS  )

Definition at line 105 of file btree_bytea.c.

References DatumGetByteaP, DatumGetPointer, gbt_var_consistent(), gbt_var_key_readable(), GIST_LEAF, GISTENTRY::key, PG_GET_COLLATION, PG_GETARG_DATUM, PG_GETARG_POINTER, PG_GETARG_UINT16, and PG_RETURN_BOOL.

106 {
107  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
108  void *query = (void *) DatumGetByteaP(PG_GETARG_DATUM(1));
110 
111  /* Oid subtype = PG_GETARG_OID(3); */
112  bool *recheck = (bool *) PG_GETARG_POINTER(4);
113  bool retval;
114  GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
116 
117  /* All cases served by this function are exact */
118  *recheck = false;
119 
120  retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
121  GIST_LEAF(entry), &tinfo, fcinfo->flinfo);
122  PG_RETURN_BOOL(retval);
123 }
#define GIST_LEAF(entry)
Definition: gist.h:133
static const gbtree_vinfo tinfo
Definition: btree_bytea.c:74
#define PG_GETARG_DATUM(n)
Definition: fmgr.h:233
uint16 StrategyNumber
Definition: stratnum.h:22
bool gbt_var_consistent(GBT_VARKEY_R *key, const void *query, StrategyNumber strategy, Oid collation, bool is_leaf, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
#define PG_GET_COLLATION()
Definition: fmgr.h:163
#define DatumGetByteaP(X)
Definition: fmgr.h:295
Datum key
Definition: gist.h:123
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:319
GBT_VARKEY_R gbt_var_key_readable(const GBT_VARKEY *k)
#define PG_GETARG_UINT16(n)
Definition: fmgr.h:237
#define DatumGetPointer(X)
Definition: postgres.h:555
Definition: c.h:439
Datum gbt_bytea_penalty ( PG_FUNCTION_ARGS  )

Definition at line 162 of file btree_bytea.c.

References gbt_var_penalty(), PG_GET_COLLATION, PG_GETARG_POINTER, PG_RETURN_POINTER, and result.

163 {
166  float *result = (float *) PG_GETARG_POINTER(2);
167 
169  &tinfo, fcinfo->flinfo));
170 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
static const gbtree_vinfo tinfo
Definition: btree_bytea.c:74
return result
Definition: formatting.c:1618
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
#define PG_GET_COLLATION()
Definition: fmgr.h:163
float * gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
Datum gbt_bytea_picksplit ( PG_FUNCTION_ARGS  )

Definition at line 139 of file btree_bytea.c.

References gbt_var_picksplit(), PG_GET_COLLATION, PG_GETARG_POINTER, and PG_RETURN_POINTER.

140 {
143 
144  gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
145  &tinfo, fcinfo->flinfo);
147 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
static const gbtree_vinfo tinfo
Definition: btree_bytea.c:74
GIST_SPLITVEC * gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
#define PG_GET_COLLATION()
Definition: fmgr.h:163
Datum gbt_bytea_same ( PG_FUNCTION_ARGS  )

Definition at line 150 of file btree_bytea.c.

References gbt_var_same(), PG_GET_COLLATION, PG_GETARG_DATUM, PG_GETARG_POINTER, PG_RETURN_POINTER, and result.

151 {
152  Datum d1 = PG_GETARG_DATUM(0);
153  Datum d2 = PG_GETARG_DATUM(1);
154  bool *result = (bool *) PG_GETARG_POINTER(2);
155 
156  *result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo, fcinfo->flinfo);
157  PG_RETURN_POINTER(result);
158 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
static const gbtree_vinfo tinfo
Definition: btree_bytea.c:74
#define PG_GETARG_DATUM(n)
Definition: fmgr.h:233
return result
Definition: formatting.c:1618
bool gbt_var_same(Datum d1, Datum d2, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
#define PG_GET_COLLATION()
Definition: fmgr.h:163
uintptr_t Datum
Definition: postgres.h:372
Datum gbt_bytea_union ( PG_FUNCTION_ARGS  )

Definition at line 128 of file btree_bytea.c.

References gbt_var_union(), PG_GET_COLLATION, PG_GETARG_POINTER, and PG_RETURN_POINTER.

129 {
131  int32 *size = (int *) PG_GETARG_POINTER(1);
132 
134  &tinfo, fcinfo->flinfo));
135 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
static const gbtree_vinfo tinfo
Definition: btree_bytea.c:74
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
#define PG_GET_COLLATION()
Definition: fmgr.h:163
signed int int32
Definition: c.h:256
GBT_VARKEY * gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
static int32 gbt_byteacmp ( const void *  a,
const void *  b,
Oid  collation,
FmgrInfo flinfo 
)
static

Definition at line 66 of file btree_bytea.c.

References byteacmp(), DatumGetInt32, DirectFunctionCall2, and PointerGetDatum.

67 {
69  PointerGetDatum(a),
70  PointerGetDatum(b)));
71 }
#define DatumGetInt32(X)
Definition: postgres.h:478
#define PointerGetDatum(X)
Definition: postgres.h:562
Datum byteacmp(PG_FUNCTION_ARGS)
Definition: varlena.c:3607
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:586
static bool gbt_byteaeq ( const void *  a,
const void *  b,
Oid  collation,
FmgrInfo flinfo 
)
static

Definition at line 42 of file btree_bytea.c.

References byteaeq(), DatumGetBool, DirectFunctionCall2, and PointerGetDatum.

43 {
45  PointerGetDatum(a),
46  PointerGetDatum(b)));
47 }
#define PointerGetDatum(X)
Definition: postgres.h:562
Datum byteaeq(PG_FUNCTION_ARGS)
Definition: varlena.c:3463
#define DatumGetBool(X)
Definition: postgres.h:399
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:586
static bool gbt_byteage ( const void *  a,
const void *  b,
Oid  collation,
FmgrInfo flinfo 
)
static

Definition at line 34 of file btree_bytea.c.

References byteage(), DatumGetBool, DirectFunctionCall2, and PointerGetDatum.

35 {
37  PointerGetDatum(a),
38  PointerGetDatum(b)));
39 }
#define PointerGetDatum(X)
Definition: postgres.h:562
Datum byteage(PG_FUNCTION_ARGS)
Definition: varlena.c:3587
#define DatumGetBool(X)
Definition: postgres.h:399
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:586
static bool gbt_byteagt ( const void *  a,
const void *  b,
Oid  collation,
FmgrInfo flinfo 
)
static

Definition at line 26 of file btree_bytea.c.

References byteagt(), DatumGetBool, DirectFunctionCall2, and PointerGetDatum.

27 {
29  PointerGetDatum(a),
30  PointerGetDatum(b)));
31 }
Datum byteagt(PG_FUNCTION_ARGS)
Definition: varlena.c:3567
#define PointerGetDatum(X)
Definition: postgres.h:562
#define DatumGetBool(X)
Definition: postgres.h:399
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:586
static bool gbt_byteale ( const void *  a,
const void *  b,
Oid  collation,
FmgrInfo flinfo 
)
static

Definition at line 50 of file btree_bytea.c.

References byteale(), DatumGetBool, DirectFunctionCall2, and PointerGetDatum.

51 {
53  PointerGetDatum(a),
54  PointerGetDatum(b)));
55 }
#define PointerGetDatum(X)
Definition: postgres.h:562
#define DatumGetBool(X)
Definition: postgres.h:399
Datum byteale(PG_FUNCTION_ARGS)
Definition: varlena.c:3547
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:586
static bool gbt_bytealt ( const void *  a,
const void *  b,
Oid  collation,
FmgrInfo flinfo 
)
static

Definition at line 58 of file btree_bytea.c.

References bytealt(), DatumGetBool, DirectFunctionCall2, and PointerGetDatum.

59 {
61  PointerGetDatum(a),
62  PointerGetDatum(b)));
63 }
#define PointerGetDatum(X)
Definition: postgres.h:562
Datum bytealt(PG_FUNCTION_ARGS)
Definition: varlena.c:3527
#define DatumGetBool(X)
Definition: postgres.h:399
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:586
PG_FUNCTION_INFO_V1 ( gbt_bytea_compress  )
PG_FUNCTION_INFO_V1 ( gbt_bytea_union  )
PG_FUNCTION_INFO_V1 ( gbt_bytea_picksplit  )
PG_FUNCTION_INFO_V1 ( gbt_bytea_consistent  )
PG_FUNCTION_INFO_V1 ( gbt_bytea_penalty  )
PG_FUNCTION_INFO_V1 ( gbt_bytea_same  )

Variable Documentation

const gbtree_vinfo tinfo
static
Initial value:
=
{
0,
}
static bool gbt_bytealt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_bytea.c:58
static bool gbt_byteage(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_bytea.c:34
static int32 gbt_byteacmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_bytea.c:66
static bool gbt_byteale(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_bytea.c:50
static bool gbt_byteaeq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_bytea.c:42
#define NULL
Definition: c.h:229
#define TRUE
Definition: c.h:217
static bool gbt_byteagt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_bytea.c:26

Definition at line 74 of file btree_bytea.c.