PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
btree_text.c File Reference
#include "postgres.h"
#include "btree_gist.h"
#include "btree_utils_var.h"
#include "mb/pg_wchar.h"
#include "utils/fmgrprotos.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 184 of file btree_text.c.

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

References gbt_text_compress().

◆ gbt_bpchar_consistent()

Datum gbt_bpchar_consistent ( PG_FUNCTION_ARGS  )

Definition at line 221 of file btree_text.c.

222{
223 GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
224 void *query = DatumGetTextP(PG_GETARG_DATUM(1));
226
227 /* Oid subtype = PG_GETARG_OID(3); */
228 bool *recheck = (bool *) PG_GETARG_POINTER(4);
229 bool retval;
232
233 /* All cases served by this function are exact */
234 *recheck = false;
235
236 if (bptinfo.eml == 0)
237 {
239 }
240
241 retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
242 GIST_LEAF(entry), &bptinfo, fcinfo->flinfo);
243 PG_RETURN_BOOL(retval);
244}
static gbtree_vinfo bptinfo
Definition: btree_text.c:150
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:641

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 142 of file btree_text.c.

143{
145 collation,
148}
Datum DirectFunctionCall2Coll(PGFunction func, Oid collation, Datum arg1, Datum arg2)
Definition: fmgr.c:812
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 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 115 of file btree_text.c.

116{
118 collation,
121}
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 106 of file btree_text.c.

107{
109 collation,
112}
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 97 of file btree_text.c.

98{
100 collation,
103}
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 124 of file btree_text.c.

125{
127 collation,
130}
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 133 of file btree_text.c.

134{
136 collation,
139}
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 171 of file btree_text.c.

172{
173 GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
174
175 if (tinfo.eml == 0)
176 {
178 }
179
181}
static gbtree_vinfo tinfo
Definition: btree_text.c:80
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 193 of file btree_text.c.

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

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 282 of file btree_text.c.

283{
286 float *result = (float *) PG_GETARG_POINTER(2);
287
289 &tinfo, fcinfo->flinfo));
290}
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 259 of file btree_text.c.

260{
263
264 gbt_var_picksplit(entryvec, v, PG_GET_COLLATION(),
265 &tinfo, fcinfo->flinfo);
267}
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 270 of file btree_text.c.

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

249{
251 int32 *size = (int *) PG_GETARG_POINTER(1);
252
254 &tinfo, fcinfo->flinfo));
255}
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_textcmp()

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

Definition at line 72 of file btree_text.c.

73{
75 collation,
78}
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 45 of file btree_text.c.

46{
48 collation,
51}
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 36 of file btree_text.c.

37{
39 collation,
42}
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 27 of file btree_text.c.

28{
30 collation,
33}
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 54 of file btree_text.c.

55{
57 collation,
60}
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 63 of file btree_text.c.

64{
66 collation,
69}
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:106
static int32 gbt_bpcharcmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:142
static bool gbt_bpchareq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:115
static bool gbt_bpcharle(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:124
static bool gbt_bpcharlt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:133
static bool gbt_bpchargt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:97

Definition at line 150 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:63
static bool gbt_textge(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:36
static int32 gbt_textcmp(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:72
static bool gbt_texteq(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:45
static bool gbt_textle(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:54
static bool gbt_textgt(const void *a, const void *b, Oid collation, FmgrInfo *flinfo)
Definition: btree_text.c:27

Definition at line 80 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().