PostgreSQL Source Code  git master
btree_bytea.c File Reference
#include "postgres.h"
#include "btree_gist.h"
#include "btree_utils_var.h"
#include "utils/fmgrprotos.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

◆ gbt_bytea_compress()

Datum gbt_bytea_compress ( PG_FUNCTION_ARGS  )

Definition at line 94 of file btree_bytea.c.

95 {
96  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
97 
99 }
static const gbtree_vinfo tinfo
Definition: btree_bytea.c:73
GISTENTRY * gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo)
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:276
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:361

References gbt_var_compress(), PG_GETARG_POINTER, PG_RETURN_POINTER, and tinfo.

◆ gbt_bytea_consistent()

Datum gbt_bytea_consistent ( PG_FUNCTION_ARGS  )

Definition at line 104 of file btree_bytea.c.

105 {
106  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
107  void *query = DatumGetByteaP(PG_GETARG_DATUM(1));
109 
110  /* Oid subtype = PG_GETARG_OID(3); */
111  bool *recheck = (bool *) PG_GETARG_POINTER(4);
112  bool retval;
115 
116  /* All cases served by this function are exact */
117  *recheck = false;
118 
119  retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
120  GIST_LEAF(entry), &tinfo, fcinfo->flinfo);
121  PG_RETURN_BOOL(retval);
122 }
bool gbt_var_consistent(GBT_VARKEY_R *key, const void *query, StrategyNumber strategy, Oid collation, bool is_leaf, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
GBT_VARKEY_R gbt_var_key_readable(const GBT_VARKEY *k)
#define PG_GETARG_DATUM(n)
Definition: fmgr.h:268
#define PG_GETARG_UINT16(n)
Definition: fmgr.h:272
#define PG_GET_COLLATION()
Definition: fmgr.h:198
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:359
#define DatumGetByteaP(X)
Definition: fmgr.h:331
#define GIST_LEAF(entry)
Definition: gist.h:170
static Pointer DatumGetPointer(Datum X)
Definition: postgres.h:312
uint16 StrategyNumber
Definition: stratnum.h:22
Datum key
Definition: gist.h:160
Definition: c.h:641

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

◆ gbt_bytea_penalty()

Datum gbt_bytea_penalty ( PG_FUNCTION_ARGS  )

Definition at line 161 of file btree_bytea.c.

162 {
165  float *result = (float *) PG_GETARG_POINTER(2);
166 
168  &tinfo, fcinfo->flinfo));
169 }
float * gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)

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

◆ gbt_bytea_picksplit()

Datum gbt_bytea_picksplit ( PG_FUNCTION_ARGS  )

Definition at line 138 of file btree_bytea.c.

139 {
142 
143  gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
144  &tinfo, fcinfo->flinfo);
146 }
GIST_SPLITVEC * gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)

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

◆ gbt_bytea_same()

Datum gbt_bytea_same ( PG_FUNCTION_ARGS  )

Definition at line 149 of file btree_bytea.c.

150 {
151  Datum d1 = PG_GETARG_DATUM(0);
152  Datum d2 = PG_GETARG_DATUM(1);
153  bool *result = (bool *) PG_GETARG_POINTER(2);
154 
155  *result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo, fcinfo->flinfo);
156  PG_RETURN_POINTER(result);
157 }
bool gbt_var_same(Datum d1, Datum d2, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
uintptr_t Datum
Definition: postgres.h:64

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

◆ gbt_bytea_union()

Datum gbt_bytea_union ( PG_FUNCTION_ARGS  )

Definition at line 127 of file btree_bytea.c.

128 {
130  int32 *size = (int *) PG_GETARG_POINTER(1);
131 
133  &tinfo, fcinfo->flinfo));
134 }
GBT_VARKEY * gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
int32_t int32
Definition: c.h:481
static pg_noinline void Size size
Definition: slab.c:607

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

◆ gbt_byteacmp()

static int32 gbt_byteacmp ( const void *  a,
const void *  b,
Oid  collation,
FmgrInfo flinfo 
)
static

Definition at line 65 of file btree_bytea.c.

66 {
69  PointerGetDatum(b)));
70 }
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:643
int b
Definition: isn.c:69
int a
Definition: isn.c:68
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:322
static int32 DatumGetInt32(Datum X)
Definition: postgres.h:202
Datum byteacmp(PG_FUNCTION_ARGS)
Definition: varlena.c:3913

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

◆ gbt_byteaeq()

static bool gbt_byteaeq ( const void *  a,
const void *  b,
Oid  collation,
FmgrInfo flinfo 
)
static

Definition at line 41 of file btree_bytea.c.

42 {
45  PointerGetDatum(b)));
46 }
static bool DatumGetBool(Datum X)
Definition: postgres.h:90
Datum byteaeq(PG_FUNCTION_ARGS)
Definition: varlena.c:3769

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

◆ gbt_byteage()

static bool gbt_byteage ( const void *  a,
const void *  b,
Oid  collation,
FmgrInfo flinfo 
)
static

Definition at line 33 of file btree_bytea.c.

34 {
37  PointerGetDatum(b)));
38 }
Datum byteage(PG_FUNCTION_ARGS)
Definition: varlena.c:3893

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

◆ gbt_byteagt()

static bool gbt_byteagt ( const void *  a,
const void *  b,
Oid  collation,
FmgrInfo flinfo 
)
static

Definition at line 25 of file btree_bytea.c.

26 {
29  PointerGetDatum(b)));
30 }
Datum byteagt(PG_FUNCTION_ARGS)
Definition: varlena.c:3873

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

◆ gbt_byteale()

static bool gbt_byteale ( const void *  a,
const void *  b,
Oid  collation,
FmgrInfo flinfo 
)
static

Definition at line 49 of file btree_bytea.c.

50 {
53  PointerGetDatum(b)));
54 }
Datum byteale(PG_FUNCTION_ARGS)
Definition: varlena.c:3853

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

◆ gbt_bytealt()

static bool gbt_bytealt ( const void *  a,
const void *  b,
Oid  collation,
FmgrInfo flinfo 
)
static

Definition at line 57 of file btree_bytea.c.

58 {
61  PointerGetDatum(b)));
62 }
Datum bytealt(PG_FUNCTION_ARGS)
Definition: varlena.c:3833

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

◆ PG_FUNCTION_INFO_V1() [1/6]

PG_FUNCTION_INFO_V1 ( gbt_bytea_compress  )

◆ PG_FUNCTION_INFO_V1() [2/6]

PG_FUNCTION_INFO_V1 ( gbt_bytea_consistent  )

◆ PG_FUNCTION_INFO_V1() [3/6]

PG_FUNCTION_INFO_V1 ( gbt_bytea_penalty  )

◆ PG_FUNCTION_INFO_V1() [4/6]

PG_FUNCTION_INFO_V1 ( gbt_bytea_picksplit  )

◆ PG_FUNCTION_INFO_V1() [5/6]

PG_FUNCTION_INFO_V1 ( gbt_bytea_same  )

◆ PG_FUNCTION_INFO_V1() [6/6]

PG_FUNCTION_INFO_V1 ( gbt_bytea_union  )

Variable Documentation

◆ tinfo

const gbtree_vinfo tinfo
static
Initial value:
=
{
0,
true,
NULL
}
static bool gbt_byteagt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_bytea.c:25
static bool gbt_byteage(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_bytea.c:33
static bool gbt_byteaeq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_bytea.c:41
static int32 gbt_byteacmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_bytea.c:65
static bool gbt_byteale(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_bytea.c:49
static bool gbt_bytealt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_bytea.c:57
@ gbt_t_bytea
Definition: btree_gist.h:33

Definition at line 73 of file btree_bytea.c.

Referenced by gbt_bytea_compress(), gbt_bytea_consistent(), gbt_bytea_penalty(), gbt_bytea_picksplit(), gbt_bytea_same(), and gbt_bytea_union().