PostgreSQL Source Code  git master
btree_gin.c File Reference
#include "postgres.h"
#include <limits.h>
#include "access/stratnum.h"
#include "utils/builtins.h"
#include "utils/bytea.h"
#include "utils/cash.h"
#include "utils/date.h"
#include "utils/inet.h"
#include "utils/numeric.h"
#include "utils/timestamp.h"
#include "utils/varbit.h"
Include dependency graph for btree_gin.c:

Go to the source code of this file.

Data Structures

struct  QueryInfo
 

Macros

#define GIN_SUPPORT(type, is_varlena, leftmostvalue, typecmp)
 
#define NUMERIC_IS_LEFTMOST(x)   ((x) == NULL)
 
#define ENUM_IS_LEFTMOST(x)   ((x) == InvalidOid)
 

Typedefs

typedef struct QueryInfo QueryInfo
 

Functions

static Datum gin_btree_extract_value (FunctionCallInfo fcinfo, bool is_varlena)
 
static Datum gin_btree_extract_query (FunctionCallInfo fcinfo, bool is_varlena, Datum(*leftmostvalue)(void), Datum(*typecmp)(FunctionCallInfo))
 
static Datum gin_btree_compare_prefix (FunctionCallInfo fcinfo)
 
 PG_FUNCTION_INFO_V1 (gin_btree_consistent)
 
Datum gin_btree_consistent (PG_FUNCTION_ARGS)
 
static Datum leftmostvalue_int2 (void)
 
static Datum leftmostvalue_int4 (void)
 
static Datum leftmostvalue_int8 (void)
 
static Datum leftmostvalue_float4 (void)
 
static Datum leftmostvalue_float8 (void)
 
static Datum leftmostvalue_money (void)
 
static Datum leftmostvalue_oid (void)
 
static Datum leftmostvalue_timestamp (void)
 
static Datum leftmostvalue_time (void)
 
static Datum leftmostvalue_timetz (void)
 
static Datum leftmostvalue_date (void)
 
static Datum leftmostvalue_interval (void)
 
static Datum leftmostvalue_macaddr (void)
 
static Datum leftmostvalue_macaddr8 (void)
 
static Datum leftmostvalue_inet (void)
 
static Datum leftmostvalue_text (void)
 
static Datum leftmostvalue_char (void)
 
static Datum leftmostvalue_bit (void)
 
static Datum leftmostvalue_varbit (void)
 
 PG_FUNCTION_INFO_V1 (gin_numeric_cmp)
 
Datum gin_numeric_cmp (PG_FUNCTION_ARGS)
 
static Datum leftmostvalue_numeric (void)
 
 PG_FUNCTION_INFO_V1 (gin_enum_cmp)
 
Datum gin_enum_cmp (PG_FUNCTION_ARGS)
 
static Datum leftmostvalue_enum (void)
 

Variables

 PG_MODULE_MAGIC
 

Macro Definition Documentation

◆ ENUM_IS_LEFTMOST

#define ENUM_IS_LEFTMOST (   x)    ((x) == InvalidOid)

Definition at line 441 of file btree_gin.c.

Referenced by gin_enum_cmp().

◆ GIN_SUPPORT

#define GIN_SUPPORT (   type,
  is_varlena,
  leftmostvalue,
  typecmp 
)
Value:
PG_FUNCTION_INFO_V1(gin_extract_value_##type); \
Datum \
gin_extract_value_##type(PG_FUNCTION_ARGS) \
{ \
return gin_btree_extract_value(fcinfo, is_varlena); \
} \
PG_FUNCTION_INFO_V1(gin_extract_query_##type); \
Datum \
gin_extract_query_##type(PG_FUNCTION_ARGS) \
{ \
return gin_btree_extract_query(fcinfo, \
is_varlena, leftmostvalue, typecmp); \
} \
PG_FUNCTION_INFO_V1(gin_compare_prefix_##type); \
Datum \
gin_compare_prefix_##type(PG_FUNCTION_ARGS) \
{ \
return gin_btree_compare_prefix(fcinfo); \
}
static Datum gin_btree_extract_query(FunctionCallInfo fcinfo, bool is_varlena, Datum(*leftmostvalue)(void), Datum(*typecmp)(FunctionCallInfo))
Definition: btree_gin.c:54
PG_FUNCTION_INFO_V1(gin_btree_consistent)
static Datum gin_btree_extract_value(FunctionCallInfo fcinfo, bool is_varlena)
Definition: btree_gin.c:31
#define PG_FUNCTION_ARGS
Definition: fmgr.h:158
static Datum gin_btree_compare_prefix(FunctionCallInfo fcinfo)
Definition: btree_gin.c:106

Definition at line 183 of file btree_gin.c.

Referenced by leftmostvalue_bit(), leftmostvalue_char(), leftmostvalue_date(), leftmostvalue_enum(), leftmostvalue_float4(), leftmostvalue_float8(), leftmostvalue_inet(), leftmostvalue_int2(), leftmostvalue_int4(), leftmostvalue_int8(), leftmostvalue_interval(), leftmostvalue_macaddr(), leftmostvalue_macaddr8(), leftmostvalue_money(), leftmostvalue_numeric(), leftmostvalue_oid(), leftmostvalue_text(), leftmostvalue_time(), leftmostvalue_timestamp(), leftmostvalue_timetz(), and leftmostvalue_varbit().

◆ NUMERIC_IS_LEFTMOST

#define NUMERIC_IS_LEFTMOST (   x)    ((x) == NULL)

Definition at line 393 of file btree_gin.c.

Referenced by gin_numeric_cmp().

Typedef Documentation

◆ QueryInfo

Function Documentation

◆ gin_btree_compare_prefix()

static Datum gin_btree_compare_prefix ( FunctionCallInfo  fcinfo)
static

Definition at line 106 of file btree_gin.c.

References BTEqualStrategyNumber, BTGreaterEqualStrategyNumber, BTGreaterStrategyNumber, BTLessEqualStrategyNumber, BTLessStrategyNumber, CallerFInfoFunctionCall2(), cmp(), QueryInfo::datum, DatumGetInt32, elog, ERROR, FunctionCallInfoData::flinfo, gin_btree_consistent(), PG_FUNCTION_INFO_V1(), PG_GET_COLLATION, PG_GETARG_DATUM, PG_GETARG_POINTER, PG_RETURN_INT32, QueryInfo::strategy, and QueryInfo::typecmp.

107 {
108  Datum a = PG_GETARG_DATUM(0);
109  Datum b = PG_GETARG_DATUM(1);
110  QueryInfo *data = (QueryInfo *) PG_GETARG_POINTER(3);
111  int32 res,
112  cmp;
113 
115  data->typecmp,
116  fcinfo->flinfo,
118  (data->strategy == BTLessStrategyNumber ||
120  ? data->datum : a,
121  b));
122 
123  switch (data->strategy)
124  {
126  /* If original datum > indexed one then return match */
127  if (cmp > 0)
128  res = 0;
129  else
130  res = 1;
131  break;
133  /* The same except equality */
134  if (cmp >= 0)
135  res = 0;
136  else
137  res = 1;
138  break;
140  if (cmp != 0)
141  res = 1;
142  else
143  res = 0;
144  break;
146  /* If original datum <= indexed one then return match */
147  if (cmp <= 0)
148  res = 0;
149  else
150  res = 1;
151  break;
153  /* If original datum <= indexed one then return match */
154  /* If original datum == indexed one then continue scan */
155  if (cmp < 0)
156  res = 0;
157  else if (cmp == 0)
158  res = -1;
159  else
160  res = 1;
161  break;
162  default:
163  elog(ERROR, "unrecognized strategy number: %d",
164  data->strategy);
165  res = 0;
166  }
167 
168  PG_RETURN_INT32(res);
169 }
#define BTGreaterStrategyNumber
Definition: stratnum.h:33
#define DatumGetInt32(X)
Definition: postgres.h:478
Datum CallerFInfoFunctionCall2(PGFunction func, FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
Definition: fmgr.c:995
#define PG_GETARG_DATUM(n)
Definition: fmgr.h:233
#define PG_RETURN_INT32(x)
Definition: fmgr.h:314
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
#define PG_GET_COLLATION()
Definition: fmgr.h:163
signed int int32
Definition: c.h:284
Datum datum
Definition: btree_gin.c:23
#define BTLessEqualStrategyNumber
Definition: stratnum.h:30
StrategyNumber strategy
Definition: btree_gin.c:22
FmgrInfo * flinfo
Definition: fmgr.h:79
#define ERROR
Definition: elog.h:43
Datum(* typecmp)(FunctionCallInfo)
Definition: btree_gin.c:25
uintptr_t Datum
Definition: postgres.h:372
#define elog
Definition: elog.h:219
#define BTLessStrategyNumber
Definition: stratnum.h:29
#define BTEqualStrategyNumber
Definition: stratnum.h:31
#define BTGreaterEqualStrategyNumber
Definition: stratnum.h:32
static int cmp(const chr *x, const chr *y, size_t len)
Definition: regc_locale.c:742

◆ gin_btree_consistent()

Datum gin_btree_consistent ( PG_FUNCTION_ARGS  )

Definition at line 173 of file btree_gin.c.

References PG_GETARG_POINTER, and PG_RETURN_BOOL.

Referenced by gin_btree_compare_prefix().

174 {
175  bool *recheck = (bool *) PG_GETARG_POINTER(5);
176 
177  *recheck = false;
178  PG_RETURN_BOOL(true);
179 }
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:319

◆ gin_btree_extract_query()

static Datum gin_btree_extract_query ( FunctionCallInfo  fcinfo,
bool  is_varlena,
Datum(*)(void)  leftmostvalue,
Datum(*)(FunctionCallInfo typecmp 
)
static

Definition at line 54 of file btree_gin.c.

References BTEqualStrategyNumber, BTGreaterEqualStrategyNumber, BTGreaterStrategyNumber, BTLessEqualStrategyNumber, BTLessStrategyNumber, QueryInfo::datum, elog, ERROR, QueryInfo::is_varlena, palloc(), PG_DETOAST_DATUM, PG_GETARG_DATUM, PG_GETARG_POINTER, PG_GETARG_UINT16, PG_RETURN_POINTER, PointerGetDatum, QueryInfo::strategy, and QueryInfo::typecmp.

58 {
59  Datum datum = PG_GETARG_DATUM(0);
60  int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
61  StrategyNumber strategy = PG_GETARG_UINT16(2);
62  bool **partialmatch = (bool **) PG_GETARG_POINTER(3);
63  Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4);
64  Datum *entries = (Datum *) palloc(sizeof(Datum));
65  QueryInfo *data = (QueryInfo *) palloc(sizeof(QueryInfo));
66  bool *ptr_partialmatch;
67 
68  *nentries = 1;
69  ptr_partialmatch = *partialmatch = (bool *) palloc(sizeof(bool));
70  *ptr_partialmatch = false;
71  if (is_varlena)
72  datum = PointerGetDatum(PG_DETOAST_DATUM(datum));
73  data->strategy = strategy;
74  data->datum = datum;
75  data->is_varlena = is_varlena;
76  data->typecmp = typecmp;
77  *extra_data = (Pointer *) palloc(sizeof(Pointer));
78  **extra_data = (Pointer) data;
79 
80  switch (strategy)
81  {
84  entries[0] = leftmostvalue();
85  *ptr_partialmatch = true;
86  break;
89  *ptr_partialmatch = true;
91  entries[0] = datum;
92  break;
93  default:
94  elog(ERROR, "unrecognized strategy number: %d", strategy);
95  }
96 
97  PG_RETURN_POINTER(entries);
98 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
#define BTGreaterStrategyNumber
Definition: stratnum.h:33
bool is_varlena
Definition: btree_gin.c:24
#define PointerGetDatum(X)
Definition: postgres.h:562
#define PG_GETARG_DATUM(n)
Definition: fmgr.h:233
uint16 StrategyNumber
Definition: stratnum.h:22
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
signed int int32
Definition: c.h:284
Datum datum
Definition: btree_gin.c:23
#define BTLessEqualStrategyNumber
Definition: stratnum.h:30
StrategyNumber strategy
Definition: btree_gin.c:22
char * Pointer
Definition: c.h:273
#define ERROR
Definition: elog.h:43
Datum(* typecmp)(FunctionCallInfo)
Definition: btree_gin.c:25
uintptr_t Datum
Definition: postgres.h:372
#define PG_GETARG_UINT16(n)
Definition: fmgr.h:237
void * palloc(Size size)
Definition: mcxt.c:848
#define PG_DETOAST_DATUM(datum)
Definition: fmgr.h:205
#define elog
Definition: elog.h:219
#define BTLessStrategyNumber
Definition: stratnum.h:29
#define BTEqualStrategyNumber
Definition: stratnum.h:31
#define BTGreaterEqualStrategyNumber
Definition: stratnum.h:32

◆ gin_btree_extract_value()

static Datum gin_btree_extract_value ( FunctionCallInfo  fcinfo,
bool  is_varlena 
)
static

Definition at line 31 of file btree_gin.c.

References QueryInfo::datum, palloc(), PG_DETOAST_DATUM, PG_GETARG_DATUM, PG_GETARG_POINTER, PG_RETURN_POINTER, and PointerGetDatum.

32 {
33  Datum datum = PG_GETARG_DATUM(0);
34  int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
35  Datum *entries = (Datum *) palloc(sizeof(Datum));
36 
37  if (is_varlena)
38  datum = PointerGetDatum(PG_DETOAST_DATUM(datum));
39  entries[0] = datum;
40  *nentries = 1;
41 
42  PG_RETURN_POINTER(entries);
43 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
#define PointerGetDatum(X)
Definition: postgres.h:562
#define PG_GETARG_DATUM(n)
Definition: fmgr.h:233
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
signed int int32
Definition: c.h:284
uintptr_t Datum
Definition: postgres.h:372
void * palloc(Size size)
Definition: mcxt.c:848
#define PG_DETOAST_DATUM(datum)
Definition: fmgr.h:205

◆ gin_enum_cmp()

Datum gin_enum_cmp ( PG_FUNCTION_ARGS  )

Definition at line 446 of file btree_gin.c.

References CallerFInfoFunctionCall2(), DatumGetInt32, enum_cmp(), ENUM_IS_LEFTMOST, FunctionCallInfoData::flinfo, ObjectIdGetDatum, PG_GET_COLLATION, PG_GETARG_OID, and PG_RETURN_INT32.

Referenced by leftmostvalue_enum().

447 {
448  Oid a = PG_GETARG_OID(0);
449  Oid b = PG_GETARG_OID(1);
450  int res = 0;
451 
452  if (ENUM_IS_LEFTMOST(a))
453  {
454  res = (ENUM_IS_LEFTMOST(b)) ? 0 : -1;
455  }
456  else if (ENUM_IS_LEFTMOST(b))
457  {
458  res = 1;
459  }
460  else
461  {
463  enum_cmp,
464  fcinfo->flinfo,
466  ObjectIdGetDatum(a),
467  ObjectIdGetDatum(b)));
468  }
469 
470  PG_RETURN_INT32(res);
471 }
#define DatumGetInt32(X)
Definition: postgres.h:478
Datum CallerFInfoFunctionCall2(PGFunction func, FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
Definition: fmgr.c:995
#define PG_RETURN_INT32(x)
Definition: fmgr.h:314
unsigned int Oid
Definition: postgres_ext.h:31
#define PG_GET_COLLATION()
Definition: fmgr.h:163
#define ObjectIdGetDatum(X)
Definition: postgres.h:513
#define PG_GETARG_OID(n)
Definition: fmgr.h:240
#define ENUM_IS_LEFTMOST(x)
Definition: btree_gin.c:441
Datum enum_cmp(PG_FUNCTION_ARGS)
Definition: enum.c:294

◆ gin_numeric_cmp()

Datum gin_numeric_cmp ( PG_FUNCTION_ARGS  )

Definition at line 398 of file btree_gin.c.

References DatumGetInt32, DirectFunctionCall2, numeric_cmp(), NUMERIC_IS_LEFTMOST, NumericGetDatum, PG_GETARG_POINTER, and PG_RETURN_INT32.

Referenced by leftmostvalue_numeric().

399 {
402  int res = 0;
403 
404  if (NUMERIC_IS_LEFTMOST(a))
405  {
406  res = (NUMERIC_IS_LEFTMOST(b)) ? 0 : -1;
407  }
408  else if (NUMERIC_IS_LEFTMOST(b))
409  {
410  res = 1;
411  }
412  else
413  {
415  NumericGetDatum(a),
416  NumericGetDatum(b)));
417  }
418 
419  PG_RETURN_INT32(res);
420 }
#define DatumGetInt32(X)
Definition: postgres.h:478
#define NumericGetDatum(X)
Definition: numeric.h:51
Datum numeric_cmp(PG_FUNCTION_ARGS)
Definition: numeric.c:2030
#define PG_RETURN_INT32(x)
Definition: fmgr.h:314
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
struct NumericData * Numeric
Definition: numeric.h:43
#define NUMERIC_IS_LEFTMOST(x)
Definition: btree_gin.c:393
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:587

◆ leftmostvalue_bit()

static Datum leftmostvalue_bit ( void  )
static

Definition at line 364 of file btree_gin.c.

References bit(), bit_in(), bitcmp(), CStringGetDatum, DirectFunctionCall3, GIN_SUPPORT, Int32GetDatum, and ObjectIdGetDatum.

365 {
367  CStringGetDatum(""),
368  ObjectIdGetDatum(0),
369  Int32GetDatum(-1));
370 }
#define ObjectIdGetDatum(X)
Definition: postgres.h:513
Datum bit_in(PG_FUNCTION_ARGS)
Definition: varbit.c:113
#define CStringGetDatum(X)
Definition: postgres.h:584
#define DirectFunctionCall3(func, arg1, arg2, arg3)
Definition: fmgr.h:589
#define Int32GetDatum(X)
Definition: postgres.h:485

◆ leftmostvalue_char()

static Datum leftmostvalue_char ( void  )
static

Definition at line 354 of file btree_gin.c.

References btcharcmp(), byteacmp(), CharGetDatum, GIN_SUPPORT, and leftmostvalue_text().

355 {
356  return CharGetDatum(SCHAR_MIN);
357 }
#define CharGetDatum(X)
Definition: postgres.h:422

◆ leftmostvalue_date()

static Datum leftmostvalue_date ( void  )
static

Definition at line 295 of file btree_gin.c.

References date_cmp(), DateADTGetDatum, DATEVAL_NOBEGIN, and GIN_SUPPORT.

296 {
298 }
#define DateADTGetDatum(X)
Definition: date.h:56
#define DATEVAL_NOBEGIN
Definition: date.h:35

◆ leftmostvalue_enum()

static Datum leftmostvalue_enum ( void  )
static

Definition at line 474 of file btree_gin.c.

References gin_enum_cmp(), GIN_SUPPORT, InvalidOid, and ObjectIdGetDatum.

475 {
477 }
#define ObjectIdGetDatum(X)
Definition: postgres.h:513
#define InvalidOid
Definition: postgres_ext.h:36

◆ leftmostvalue_float4()

static Datum leftmostvalue_float4 ( void  )
static

Definition at line 232 of file btree_gin.c.

References btfloat4cmp(), Float4GetDatum(), get_float4_infinity(), and GIN_SUPPORT.

233 {
235 }
float get_float4_infinity(void)
Definition: float.c:146
Datum Float4GetDatum(float4 X)
Definition: fmgr.c:1798

◆ leftmostvalue_float8()

static Datum leftmostvalue_float8 ( void  )
static

Definition at line 240 of file btree_gin.c.

References btfloat8cmp(), Float8GetDatum(), get_float8_infinity(), and GIN_SUPPORT.

241 {
243 }
Datum Float8GetDatum(float8 X)
Definition: fmgr.c:1810
double get_float8_infinity(void)
Definition: float.c:121

◆ leftmostvalue_inet()

static Datum leftmostvalue_inet ( void  )
static

Definition at line 336 of file btree_gin.c.

References CStringGetDatum, DirectFunctionCall1, GIN_SUPPORT, inet_in(), and network_cmp().

337 {
338  return DirectFunctionCall1(inet_in, CStringGetDatum("0.0.0.0/0"));
339 }
#define DirectFunctionCall1(func, arg1)
Definition: fmgr.h:585
#define CStringGetDatum(X)
Definition: postgres.h:584
Datum inet_in(PG_FUNCTION_ARGS)
Definition: network.c:80

◆ leftmostvalue_int2()

static Datum leftmostvalue_int2 ( void  )
static

Definition at line 208 of file btree_gin.c.

References btint2cmp(), GIN_SUPPORT, and Int16GetDatum.

209 {
210  return Int16GetDatum(SHRT_MIN);
211 }
#define Int16GetDatum(X)
Definition: postgres.h:457

◆ leftmostvalue_int4()

static Datum leftmostvalue_int4 ( void  )
static

Definition at line 216 of file btree_gin.c.

References btint4cmp(), GIN_SUPPORT, and Int32GetDatum.

217 {
218  return Int32GetDatum(INT_MIN);
219 }
#define Int32GetDatum(X)
Definition: postgres.h:485

◆ leftmostvalue_int8()

static Datum leftmostvalue_int8 ( void  )
static

Definition at line 224 of file btree_gin.c.

References btint8cmp(), GIN_SUPPORT, Int64GetDatum(), and PG_INT64_MIN.

225 {
226  return Int64GetDatum(PG_INT64_MIN);
227 }
#define PG_INT64_MIN
Definition: c.h:381
Datum Int64GetDatum(int64 X)
Definition: fmgr.c:1786

◆ leftmostvalue_interval()

static Datum leftmostvalue_interval ( void  )
static

Definition at line 303 of file btree_gin.c.

References Interval::day, DT_NOBEGIN, GIN_SUPPORT, interval_cmp(), IntervalPGetDatum, Interval::month, palloc(), and Interval::time.

304 {
305  Interval *v = palloc(sizeof(Interval));
306 
307  v->time = DT_NOBEGIN;
308  v->day = 0;
309  v->month = 0;
310  return IntervalPGetDatum(v);
311 }
int32 day
Definition: timestamp.h:47
#define IntervalPGetDatum(X)
Definition: timestamp.h:33
TimeOffset time
Definition: timestamp.h:45
int32 month
Definition: timestamp.h:48
void * palloc(Size size)
Definition: mcxt.c:848
#define DT_NOBEGIN
Definition: timestamp.h:109

◆ leftmostvalue_macaddr()

static Datum leftmostvalue_macaddr ( void  )
static

Definition at line 316 of file btree_gin.c.

References GIN_SUPPORT, macaddr_cmp(), MacaddrPGetDatum, and palloc0().

317 {
318  macaddr *v = palloc0(sizeof(macaddr));
319 
320  return MacaddrPGetDatum(v);
321 }
#define MacaddrPGetDatum(X)
Definition: inet.h:132
void * palloc0(Size size)
Definition: mcxt.c:877
Definition: inet.h:94

◆ leftmostvalue_macaddr8()

static Datum leftmostvalue_macaddr8 ( void  )
static

Definition at line 326 of file btree_gin.c.

References GIN_SUPPORT, macaddr8_cmp(), Macaddr8PGetDatum, and palloc0().

327 {
328  macaddr8 *v = palloc0(sizeof(macaddr8));
329 
330  return Macaddr8PGetDatum(v);
331 }
Definition: inet.h:107
void * palloc0(Size size)
Definition: mcxt.c:877
#define Macaddr8PGetDatum(X)
Definition: inet.h:138

◆ leftmostvalue_money()

static Datum leftmostvalue_money ( void  )
static

Definition at line 248 of file btree_gin.c.

References cash_cmp(), GIN_SUPPORT, Int64GetDatum(), and PG_INT64_MIN.

249 {
250  return Int64GetDatum(PG_INT64_MIN);
251 }
#define PG_INT64_MIN
Definition: c.h:381
Datum Int64GetDatum(int64 X)
Definition: fmgr.c:1786

◆ leftmostvalue_numeric()

static Datum leftmostvalue_numeric ( void  )
static

Definition at line 423 of file btree_gin.c.

References gin_numeric_cmp(), GIN_SUPPORT, and PointerGetDatum.

424 {
425  return PointerGetDatum(NULL);
426 }
#define PointerGetDatum(X)
Definition: postgres.h:562

◆ leftmostvalue_oid()

static Datum leftmostvalue_oid ( void  )
static

Definition at line 256 of file btree_gin.c.

References btoidcmp(), GIN_SUPPORT, and ObjectIdGetDatum.

257 {
258  return ObjectIdGetDatum(0);
259 }
#define ObjectIdGetDatum(X)
Definition: postgres.h:513

◆ leftmostvalue_text()

static Datum leftmostvalue_text ( void  )
static

Definition at line 346 of file btree_gin.c.

References bttextcmp(), cstring_to_text_with_len(), GIN_SUPPORT, and PointerGetDatum.

Referenced by leftmostvalue_char().

347 {
349 }
#define PointerGetDatum(X)
Definition: postgres.h:562
text * cstring_to_text_with_len(const char *s, int len)
Definition: varlena.c:161

◆ leftmostvalue_time()

static Datum leftmostvalue_time ( void  )
static

Definition at line 274 of file btree_gin.c.

References GIN_SUPPORT, time_cmp(), and TimeADTGetDatum.

275 {
276  return TimeADTGetDatum(0);
277 }
#define TimeADTGetDatum(X)
Definition: date.h:57

◆ leftmostvalue_timestamp()

static Datum leftmostvalue_timestamp ( void  )
static

Definition at line 264 of file btree_gin.c.

References DT_NOBEGIN, GIN_SUPPORT, timestamp_cmp(), TimestampGetDatum, and timestamptz.

265 {
267 }
#define TimestampGetDatum(X)
Definition: timestamp.h:31
#define DT_NOBEGIN
Definition: timestamp.h:109

◆ leftmostvalue_timetz()

static Datum leftmostvalue_timetz ( void  )
static

Definition at line 282 of file btree_gin.c.

References GIN_SUPPORT, palloc(), TimeTzADT::time, timetz_cmp(), TimeTzADTPGetDatum, and TimeTzADT::zone.

283 {
284  TimeTzADT *v = palloc(sizeof(TimeTzADT));
285 
286  v->time = 0;
287  v->zone = -24 * 3600; /* XXX is that true? */
288 
289  return TimeTzADTPGetDatum(v);
290 }
TimeADT time
Definition: date.h:28
#define TimeTzADTPGetDatum(X)
Definition: date.h:58
int32 zone
Definition: date.h:29
void * palloc(Size size)
Definition: mcxt.c:848
Definition: date.h:26

◆ leftmostvalue_varbit()

static Datum leftmostvalue_varbit ( void  )
static

Definition at line 375 of file btree_gin.c.

References bitcmp(), CStringGetDatum, DirectFunctionCall3, GIN_SUPPORT, Int32GetDatum, ObjectIdGetDatum, varbit(), and varbit_in().

376 {
378  CStringGetDatum(""),
379  ObjectIdGetDatum(0),
380  Int32GetDatum(-1));
381 }
Datum varbit_in(PG_FUNCTION_ARGS)
Definition: varbit.c:429
#define ObjectIdGetDatum(X)
Definition: postgres.h:513
#define CStringGetDatum(X)
Definition: postgres.h:584
#define DirectFunctionCall3(func, arg1, arg2, arg3)
Definition: fmgr.h:589
#define Int32GetDatum(X)
Definition: postgres.h:485

◆ PG_FUNCTION_INFO_V1() [1/3]

PG_FUNCTION_INFO_V1 ( gin_btree_consistent  )

◆ PG_FUNCTION_INFO_V1() [2/3]

PG_FUNCTION_INFO_V1 ( gin_numeric_cmp  )

◆ PG_FUNCTION_INFO_V1() [3/3]

PG_FUNCTION_INFO_V1 ( gin_enum_cmp  )

Variable Documentation

◆ PG_MODULE_MAGIC

PG_MODULE_MAGIC

Definition at line 18 of file btree_gin.c.