PostgreSQL Source Code  git master
btree_text.c File Reference
#include "postgres.h"
#include "btree_gist.h"
#include "btree_utils_var.h"
#include "utils/builtins.h"
Include dependency graph for btree_text.c:

Go to the source code of this file.

Functions

 PG_FUNCTION_INFO_V1 (gbt_text_compress)
 
 PG_FUNCTION_INFO_V1 (gbt_bpchar_compress)
 
 PG_FUNCTION_INFO_V1 (gbt_text_union)
 
 PG_FUNCTION_INFO_V1 (gbt_text_picksplit)
 
 PG_FUNCTION_INFO_V1 (gbt_text_consistent)
 
 PG_FUNCTION_INFO_V1 (gbt_bpchar_consistent)
 
 PG_FUNCTION_INFO_V1 (gbt_text_penalty)
 
 PG_FUNCTION_INFO_V1 (gbt_text_same)
 
static bool gbt_textgt (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_textge (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_texteq (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_textle (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_textlt (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static int32 gbt_textcmp (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_bpchargt (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_bpcharge (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_bpchareq (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_bpcharle (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static bool gbt_bpcharlt (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
static int32 gbt_bpcharcmp (const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
 
Datum gbt_text_compress (PG_FUNCTION_ARGS)
 
Datum gbt_bpchar_compress (PG_FUNCTION_ARGS)
 
Datum gbt_text_consistent (PG_FUNCTION_ARGS)
 
Datum gbt_bpchar_consistent (PG_FUNCTION_ARGS)
 
Datum gbt_text_union (PG_FUNCTION_ARGS)
 
Datum gbt_text_picksplit (PG_FUNCTION_ARGS)
 
Datum gbt_text_same (PG_FUNCTION_ARGS)
 
Datum gbt_text_penalty (PG_FUNCTION_ARGS)
 

Variables

static gbtree_vinfo tinfo
 
static gbtree_vinfo bptinfo
 

Function Documentation

◆ gbt_bpchar_compress()

Datum gbt_bpchar_compress ( PG_FUNCTION_ARGS  )

Definition at line 183 of file btree_text.c.

184 {
185  /* This should never have been distinct from gbt_text_compress */
186  return gbt_text_compress(fcinfo);
187 }
Datum gbt_text_compress(PG_FUNCTION_ARGS)
Definition: btree_text.c:170

References gbt_text_compress().

◆ gbt_bpchar_consistent()

Datum gbt_bpchar_consistent ( PG_FUNCTION_ARGS  )

Definition at line 220 of file btree_text.c.

221 {
222  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
223  void *query = (void *) DatumGetTextP(PG_GETARG_DATUM(1));
225 
226  /* Oid subtype = PG_GETARG_OID(3); */
227  bool *recheck = (bool *) PG_GETARG_POINTER(4);
228  bool retval;
231 
232  /* All cases served by this function are exact */
233  *recheck = false;
234 
235  if (bptinfo.eml == 0)
236  {
238  }
239 
240  retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
241  GIST_LEAF(entry), &bptinfo, fcinfo->flinfo);
242  PG_RETURN_BOOL(retval);
243 }
static gbtree_vinfo bptinfo
Definition: btree_text.c:149
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_POINTER(n)
Definition: fmgr.h:276
#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 DatumGetTextP(X)
Definition: fmgr.h:332
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:359
#define GIST_LEAF(entry)
Definition: gist.h:170
int pg_database_encoding_max_length(void)
Definition: mbutils.c:1546
static Pointer DatumGetPointer(Datum X)
Definition: postgres.h:312
uint16 StrategyNumber
Definition: stratnum.h:22
Datum key
Definition: gist.h:160
Definition: c.h:690

References bptinfo, DatumGetPointer(), DatumGetTextP, gbtree_vinfo::eml, gbt_var_consistent(), gbt_var_key_readable(), GIST_LEAF, GISTENTRY::key, sort-test::key, pg_database_encoding_max_length(), PG_GET_COLLATION, PG_GETARG_DATUM, PG_GETARG_POINTER, PG_GETARG_UINT16, and PG_RETURN_BOOL.

◆ gbt_bpcharcmp()

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

Definition at line 141 of file btree_text.c.

142 {
144  collation,
146  PointerGetDatum(b)));
147 }
Datum DirectFunctionCall2Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2)
Definition: fmgr.c:812
int b
Definition: isn.c:70
int a
Definition: isn.c:69
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:322
static int32 DatumGetInt32(Datum X)
Definition: postgres.h:202
Datum bpcharcmp(PG_FUNCTION_ARGS)
Definition: varchar.c:909

References a, b, bpcharcmp(), DatumGetInt32(), DirectFunctionCall2Coll(), and PointerGetDatum().

◆ gbt_bpchareq()

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

Definition at line 114 of file btree_text.c.

115 {
117  collation,
119  PointerGetDatum(b)));
120 }
static bool DatumGetBool(Datum X)
Definition: postgres.h:90
Datum bpchareq(PG_FUNCTION_ARGS)
Definition: varchar.c:743

References a, b, bpchareq(), DatumGetBool(), DirectFunctionCall2Coll(), and PointerGetDatum().

◆ gbt_bpcharge()

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

Definition at line 105 of file btree_text.c.

106 {
108  collation,
110  PointerGetDatum(b)));
111 }
Datum bpcharge(PG_FUNCTION_ARGS)
Definition: varchar.c:888

References a, b, bpcharge(), DatumGetBool(), DirectFunctionCall2Coll(), and PointerGetDatum().

◆ gbt_bpchargt()

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

Definition at line 96 of file btree_text.c.

97 {
99  collation,
101  PointerGetDatum(b)));
102 }
Datum bpchargt(PG_FUNCTION_ARGS)
Definition: varchar.c:867

References a, b, bpchargt(), DatumGetBool(), DirectFunctionCall2Coll(), and PointerGetDatum().

◆ gbt_bpcharle()

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

Definition at line 123 of file btree_text.c.

124 {
126  collation,
128  PointerGetDatum(b)));
129 }
Datum bpcharle(PG_FUNCTION_ARGS)
Definition: varchar.c:846

References a, b, bpcharle(), DatumGetBool(), DirectFunctionCall2Coll(), and PointerGetDatum().

◆ gbt_bpcharlt()

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

Definition at line 132 of file btree_text.c.

133 {
135  collation,
137  PointerGetDatum(b)));
138 }
Datum bpcharlt(PG_FUNCTION_ARGS)
Definition: varchar.c:825

References a, b, bpcharlt(), DatumGetBool(), DirectFunctionCall2Coll(), and PointerGetDatum().

◆ gbt_text_compress()

Datum gbt_text_compress ( PG_FUNCTION_ARGS  )

Definition at line 170 of file btree_text.c.

171 {
172  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
173 
174  if (tinfo.eml == 0)
175  {
177  }
178 
180 }
static gbtree_vinfo tinfo
Definition: btree_text.c:79
GISTENTRY * gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo)
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:361

References gbtree_vinfo::eml, gbt_var_compress(), pg_database_encoding_max_length(), PG_GETARG_POINTER, PG_RETURN_POINTER, and tinfo.

Referenced by gbt_bpchar_compress().

◆ gbt_text_consistent()

Datum gbt_text_consistent ( PG_FUNCTION_ARGS  )

Definition at line 192 of file btree_text.c.

193 {
194  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
195  void *query = (void *) DatumGetTextP(PG_GETARG_DATUM(1));
197 
198  /* Oid subtype = PG_GETARG_OID(3); */
199  bool *recheck = (bool *) PG_GETARG_POINTER(4);
200  bool retval;
203 
204  /* All cases served by this function are exact */
205  *recheck = false;
206 
207  if (tinfo.eml == 0)
208  {
210  }
211 
212  retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
213  GIST_LEAF(entry), &tinfo, fcinfo->flinfo);
214 
215  PG_RETURN_BOOL(retval);
216 }

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

◆ gbt_text_penalty()

Datum gbt_text_penalty ( PG_FUNCTION_ARGS  )

Definition at line 281 of file btree_text.c.

282 {
285  float *result = (float *) PG_GETARG_POINTER(2);
286 
288  &tinfo, fcinfo->flinfo));
289 }
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_text_picksplit()

Datum gbt_text_picksplit ( PG_FUNCTION_ARGS  )

Definition at line 258 of file btree_text.c.

259 {
262 
263  gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
264  &tinfo, fcinfo->flinfo);
266 }
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_text_same()

Datum gbt_text_same ( PG_FUNCTION_ARGS  )

Definition at line 269 of file btree_text.c.

270 {
271  Datum d1 = PG_GETARG_DATUM(0);
272  Datum d2 = PG_GETARG_DATUM(1);
273  bool *result = (bool *) PG_GETARG_POINTER(2);
274 
275  *result = gbt_var_same(d1, d2, PG_GET_COLLATION(), &tinfo, fcinfo->flinfo);
276  PG_RETURN_POINTER(result);
277 }
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_text_union()

Datum gbt_text_union ( PG_FUNCTION_ARGS  )

Definition at line 247 of file btree_text.c.

248 {
250  int32 *size = (int *) PG_GETARG_POINTER(1);
251 
253  &tinfo, fcinfo->flinfo));
254 }
GBT_VARKEY * gbt_var_union(const GistEntryVector *entryvec, int32 *size, Oid collation, const gbtree_vinfo *tinfo, FmgrInfo *flinfo)
signed int int32
Definition: c.h:497
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_textcmp()

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

Definition at line 71 of file btree_text.c.

72 {
74  collation,
76  PointerGetDatum(b)));
77 }
Datum bttextcmp(PG_FUNCTION_ARGS)
Definition: varlena.c:1814

References a, b, bttextcmp(), DatumGetInt32(), DirectFunctionCall2Coll(), and PointerGetDatum().

◆ gbt_texteq()

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

Definition at line 44 of file btree_text.c.

45 {
47  collation,
49  PointerGetDatum(b)));
50 }
Datum texteq(PG_FUNCTION_ARGS)
Definition: varlena.c:1611

References a, b, DatumGetBool(), DirectFunctionCall2Coll(), PointerGetDatum(), and texteq().

◆ gbt_textge()

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

Definition at line 35 of file btree_text.c.

36 {
38  collation,
40  PointerGetDatum(b)));
41 }
Datum text_ge(PG_FUNCTION_ARGS)
Definition: varlena.c:1760

References a, b, DatumGetBool(), DirectFunctionCall2Coll(), PointerGetDatum(), and text_ge().

◆ gbt_textgt()

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

Definition at line 26 of file btree_text.c.

27 {
29  collation,
31  PointerGetDatum(b)));
32 }
Datum text_gt(PG_FUNCTION_ARGS)
Definition: varlena.c:1745

References a, b, DatumGetBool(), DirectFunctionCall2Coll(), PointerGetDatum(), and text_gt().

◆ gbt_textle()

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

Definition at line 53 of file btree_text.c.

54 {
56  collation,
58  PointerGetDatum(b)));
59 }
Datum text_le(PG_FUNCTION_ARGS)
Definition: varlena.c:1730

References a, b, DatumGetBool(), DirectFunctionCall2Coll(), PointerGetDatum(), and text_le().

◆ gbt_textlt()

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

Definition at line 62 of file btree_text.c.

63 {
65  collation,
67  PointerGetDatum(b)));
68 }
Datum text_lt(PG_FUNCTION_ARGS)
Definition: varlena.c:1715

References a, b, DatumGetBool(), DirectFunctionCall2Coll(), PointerGetDatum(), and text_lt().

◆ PG_FUNCTION_INFO_V1() [1/8]

PG_FUNCTION_INFO_V1 ( gbt_bpchar_compress  )

◆ PG_FUNCTION_INFO_V1() [2/8]

PG_FUNCTION_INFO_V1 ( gbt_bpchar_consistent  )

◆ PG_FUNCTION_INFO_V1() [3/8]

PG_FUNCTION_INFO_V1 ( gbt_text_compress  )

◆ PG_FUNCTION_INFO_V1() [4/8]

PG_FUNCTION_INFO_V1 ( gbt_text_consistent  )

◆ PG_FUNCTION_INFO_V1() [5/8]

PG_FUNCTION_INFO_V1 ( gbt_text_penalty  )

◆ PG_FUNCTION_INFO_V1() [6/8]

PG_FUNCTION_INFO_V1 ( gbt_text_picksplit  )

◆ PG_FUNCTION_INFO_V1() [7/8]

PG_FUNCTION_INFO_V1 ( gbt_text_same  )

◆ PG_FUNCTION_INFO_V1() [8/8]

PG_FUNCTION_INFO_V1 ( gbt_text_union  )

Variable Documentation

◆ bptinfo

gbtree_vinfo bptinfo
static
Initial value:
=
{
0,
false,
NULL
}
@ gbt_t_bpchar
Definition: btree_gist.h:32
static bool gbt_bpcharge(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:105
static int32 gbt_bpcharcmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:141
static bool gbt_bpchareq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:114
static bool gbt_bpcharle(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:123
static bool gbt_bpcharlt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:132
static bool gbt_bpchargt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:96

Definition at line 149 of file btree_text.c.

Referenced by gbt_bpchar_consistent().

◆ tinfo

gbtree_vinfo tinfo
static
Initial value:
=
{
0,
false,
NULL
}
@ gbt_t_text
Definition: btree_gist.h:31
static bool gbt_textlt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:62
static bool gbt_textge(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:35
static int32 gbt_textcmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:71
static bool gbt_texteq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:44
static bool gbt_textle(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:53
static bool gbt_textgt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:26

Definition at line 79 of file btree_text.c.

Referenced by gbt_text_compress(), gbt_text_consistent(), gbt_text_penalty(), gbt_text_picksplit(), gbt_text_same(), and gbt_text_union().