PostgreSQL Source Code  git master
btree_time.c File Reference
#include "postgres.h"
#include "btree_gist.h"
#include "btree_utils_num.h"
#include "utils/builtins.h"
#include "utils/date.h"
#include "utils/timestamp.h"
Include dependency graph for btree_time.c:

Go to the source code of this file.

Data Structures

struct  timeKEY
 

Macros

#define TimeADTGetDatumFast(X)   PointerGetDatum(&(X))
 

Functions

 PG_FUNCTION_INFO_V1 (gbt_time_compress)
 
 PG_FUNCTION_INFO_V1 (gbt_timetz_compress)
 
 PG_FUNCTION_INFO_V1 (gbt_time_fetch)
 
 PG_FUNCTION_INFO_V1 (gbt_time_union)
 
 PG_FUNCTION_INFO_V1 (gbt_time_picksplit)
 
 PG_FUNCTION_INFO_V1 (gbt_time_consistent)
 
 PG_FUNCTION_INFO_V1 (gbt_time_distance)
 
 PG_FUNCTION_INFO_V1 (gbt_timetz_consistent)
 
 PG_FUNCTION_INFO_V1 (gbt_time_penalty)
 
 PG_FUNCTION_INFO_V1 (gbt_time_same)
 
static bool gbt_timegt (const void *a, const void *b, FmgrInfo *flinfo)
 
static bool gbt_timege (const void *a, const void *b, FmgrInfo *flinfo)
 
static bool gbt_timeeq (const void *a, const void *b, FmgrInfo *flinfo)
 
static bool gbt_timele (const void *a, const void *b, FmgrInfo *flinfo)
 
static bool gbt_timelt (const void *a, const void *b, FmgrInfo *flinfo)
 
static int gbt_timekey_cmp (const void *a, const void *b, FmgrInfo *flinfo)
 
static float8 gbt_time_dist (const void *a, const void *b, FmgrInfo *flinfo)
 
 PG_FUNCTION_INFO_V1 (time_dist)
 
Datum time_dist (PG_FUNCTION_ARGS)
 
Datum gbt_time_compress (PG_FUNCTION_ARGS)
 
Datum gbt_timetz_compress (PG_FUNCTION_ARGS)
 
Datum gbt_time_fetch (PG_FUNCTION_ARGS)
 
Datum gbt_time_consistent (PG_FUNCTION_ARGS)
 
Datum gbt_time_distance (PG_FUNCTION_ARGS)
 
Datum gbt_timetz_consistent (PG_FUNCTION_ARGS)
 
Datum gbt_time_union (PG_FUNCTION_ARGS)
 
Datum gbt_time_penalty (PG_FUNCTION_ARGS)
 
Datum gbt_time_picksplit (PG_FUNCTION_ARGS)
 
Datum gbt_time_same (PG_FUNCTION_ARGS)
 

Variables

static const gbtree_ninfo tinfo
 

Macro Definition Documentation

◆ TimeADTGetDatumFast

#define TimeADTGetDatumFast (   X)    PointerGetDatum(&(X))

Function Documentation

◆ gbt_time_compress()

Datum gbt_time_compress ( PG_FUNCTION_ARGS  )

Definition at line 159 of file btree_time.c.

References gbt_num_compress(), PG_GETARG_POINTER, and PG_RETURN_POINTER.

160 {
161  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
162 
164 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
GISTENTRY * gbt_num_compress(GISTENTRY *entry, const gbtree_ninfo *tinfo)
static const gbtree_ninfo tinfo
Definition: btree_time.c:125

◆ gbt_time_consistent()

Datum gbt_time_consistent ( PG_FUNCTION_ARGS  )

Definition at line 202 of file btree_time.c.

References DatumGetPointer, gbt_num_consistent(), GIST_LEAF, GISTENTRY::key, timeKEY::lower, GBT_NUMKEY_R::lower, PG_GETARG_POINTER, PG_GETARG_TIMEADT, PG_GETARG_UINT16, PG_RETURN_BOOL, timeKEY::upper, and GBT_NUMKEY_R::upper.

203 {
204  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
205  TimeADT query = PG_GETARG_TIMEADT(1);
207 
208  /* Oid subtype = PG_GETARG_OID(3); */
209  bool *recheck = (bool *) PG_GETARG_POINTER(4);
210  timeKEY *kkk = (timeKEY *) DatumGetPointer(entry->key);
211  GBT_NUMKEY_R key;
212 
213  /* All cases served by this function are exact */
214  *recheck = false;
215 
216  key.lower = (GBT_NUMKEY *) &kkk->lower;
217  key.upper = (GBT_NUMKEY *) &kkk->upper;
218 
220  gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
221  );
222 }
#define GIST_LEAF(entry)
Definition: gist.h:133
const GBT_NUMKEY * lower
TimeADT lower
Definition: btree_time.c:14
uint16 StrategyNumber
Definition: stratnum.h:22
const GBT_NUMKEY * upper
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
bool gbt_num_consistent(const GBT_NUMKEY_R *key, const void *query, const StrategyNumber *strategy, bool is_leaf, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
static const gbtree_ninfo tinfo
Definition: btree_time.c:125
TimeADT upper
Definition: btree_time.c:15
Datum key
Definition: gist.h:123
char GBT_NUMKEY
int64 TimeADT
Definition: date.h:24
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:319
#define PG_GETARG_TIMEADT(n)
Definition: date.h:61
#define PG_GETARG_UINT16(n)
Definition: fmgr.h:237
#define DatumGetPointer(X)
Definition: postgres.h:555

◆ gbt_time_dist()

static float8 gbt_time_dist ( const void *  a,
const void *  b,
FmgrInfo flinfo 
)
static

Definition at line 112 of file btree_time.c.

References Abs, DatumGetIntervalP, DirectFunctionCall2, i, INTERVAL_TO_SEC, time_mi_time(), and TimeADTGetDatumFast.

113 {
114  const TimeADT *aa = (const TimeADT *) a;
115  const TimeADT *bb = (const TimeADT *) b;
116  Interval *i;
117 
119  TimeADTGetDatumFast(*aa),
120  TimeADTGetDatumFast(*bb)));
121  return (float8) Abs(INTERVAL_TO_SEC(i));
122 }
#define DatumGetIntervalP(X)
Definition: timestamp.h:29
#define TimeADTGetDatumFast(X)
Definition: btree_time.c:36
#define Abs(x)
Definition: c.h:808
double float8
Definition: c.h:429
int64 TimeADT
Definition: date.h:24
Datum time_mi_time(PG_FUNCTION_ARGS)
Definition: date.c:1796
int i
#define INTERVAL_TO_SEC(ivp)
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:587

◆ gbt_time_distance()

Datum gbt_time_distance ( PG_FUNCTION_ARGS  )

Definition at line 225 of file btree_time.c.

References DatumGetPointer, gbt_num_distance(), GIST_LEAF, GISTENTRY::key, timeKEY::lower, GBT_NUMKEY_R::lower, PG_GETARG_POINTER, PG_GETARG_TIMEADT, PG_RETURN_FLOAT8, timeKEY::upper, and GBT_NUMKEY_R::upper.

226 {
227  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
228  TimeADT query = PG_GETARG_TIMEADT(1);
229 
230  /* Oid subtype = PG_GETARG_OID(3); */
231  timeKEY *kkk = (timeKEY *) DatumGetPointer(entry->key);
232  GBT_NUMKEY_R key;
233 
234  key.lower = (GBT_NUMKEY *) &kkk->lower;
235  key.upper = (GBT_NUMKEY *) &kkk->upper;
236 
238  gbt_num_distance(&key, (void *) &query, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
239  );
240 }
#define GIST_LEAF(entry)
Definition: gist.h:133
const GBT_NUMKEY * lower
float8 gbt_num_distance(const GBT_NUMKEY_R *key, const void *query, bool is_leaf, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
#define PG_RETURN_FLOAT8(x)
Definition: fmgr.h:326
TimeADT lower
Definition: btree_time.c:14
const GBT_NUMKEY * upper
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
static const gbtree_ninfo tinfo
Definition: btree_time.c:125
TimeADT upper
Definition: btree_time.c:15
Datum key
Definition: gist.h:123
char GBT_NUMKEY
int64 TimeADT
Definition: date.h:24
#define PG_GETARG_TIMEADT(n)
Definition: date.h:61
#define DatumGetPointer(X)
Definition: postgres.h:555

◆ gbt_time_fetch()

Datum gbt_time_fetch ( PG_FUNCTION_ARGS  )

Definition at line 194 of file btree_time.c.

References gbt_num_fetch(), PG_GETARG_POINTER, and PG_RETURN_POINTER.

195 {
196  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
197 
199 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
GISTENTRY * gbt_num_fetch(GISTENTRY *entry, const gbtree_ninfo *tinfo)
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
static const gbtree_ninfo tinfo
Definition: btree_time.c:125

◆ gbt_time_penalty()

Datum gbt_time_penalty ( PG_FUNCTION_ARGS  )

Definition at line 281 of file btree_time.c.

References DatumGetIntervalP, DatumGetPointer, DirectFunctionCall2, INTERVAL_TO_SEC, timeKEY::lower, Max, PG_GETARG_POINTER, PG_RETURN_POINTER, time_mi_time(), TimeADTGetDatumFast, and timeKEY::upper.

282 {
283  timeKEY *origentry = (timeKEY *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(0))->key);
284  timeKEY *newentry = (timeKEY *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(1))->key);
285  float *result = (float *) PG_GETARG_POINTER(2);
286  Interval *intr;
287  double res;
288  double res2;
289 
291  time_mi_time,
292  TimeADTGetDatumFast(newentry->upper),
293  TimeADTGetDatumFast(origentry->upper)));
294  res = INTERVAL_TO_SEC(intr);
295  res = Max(res, 0);
296 
298  time_mi_time,
299  TimeADTGetDatumFast(origentry->lower),
300  TimeADTGetDatumFast(newentry->lower)));
301  res2 = INTERVAL_TO_SEC(intr);
302  res2 = Max(res2, 0);
303 
304  res += res2;
305 
306  *result = 0.0;
307 
308  if (res > 0)
309  {
311  time_mi_time,
312  TimeADTGetDatumFast(origentry->upper),
313  TimeADTGetDatumFast(origentry->lower)));
314  *result += FLT_MIN;
315  *result += (float) (res / (res + INTERVAL_TO_SEC(intr)));
316  *result *= (FLT_MAX / (((GISTENTRY *) PG_GETARG_POINTER(0))->rel->rd_att->natts + 1));
317  }
318 
319  PG_RETURN_POINTER(result);
320 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
#define DatumGetIntervalP(X)
Definition: timestamp.h:29
#define TimeADTGetDatumFast(X)
Definition: btree_time.c:36
TimeADT lower
Definition: btree_time.c:14
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
TimeADT upper
Definition: btree_time.c:15
#define Max(x, y)
Definition: c.h:796
#define DatumGetPointer(X)
Definition: postgres.h:555
Datum time_mi_time(PG_FUNCTION_ARGS)
Definition: date.c:1796
#define INTERVAL_TO_SEC(ivp)
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:587

◆ gbt_time_picksplit()

Datum gbt_time_picksplit ( PG_FUNCTION_ARGS  )

Definition at line 324 of file btree_time.c.

References gbt_num_picksplit(), PG_GETARG_POINTER, and PG_RETURN_POINTER.

325 {
329  &tinfo, fcinfo->flinfo
330  ));
331 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
static const gbtree_ninfo tinfo
Definition: btree_time.c:125
GIST_SPLITVEC * gbt_num_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)

◆ gbt_time_same()

Datum gbt_time_same ( PG_FUNCTION_ARGS  )

Definition at line 334 of file btree_time.c.

References gbt_num_same(), PG_GETARG_POINTER, and PG_RETURN_POINTER.

335 {
336  timeKEY *b1 = (timeKEY *) PG_GETARG_POINTER(0);
337  timeKEY *b2 = (timeKEY *) PG_GETARG_POINTER(1);
338  bool *result = (bool *) PG_GETARG_POINTER(2);
339 
340  *result = gbt_num_same((void *) b1, (void *) b2, &tinfo, fcinfo->flinfo);
341  PG_RETURN_POINTER(result);
342 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
bool gbt_num_same(const GBT_NUMKEY *a, const GBT_NUMKEY *b, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
static const gbtree_ninfo tinfo
Definition: btree_time.c:125

◆ gbt_time_union()

Datum gbt_time_union ( PG_FUNCTION_ARGS  )

Definition at line 270 of file btree_time.c.

References gbt_num_union(), palloc(), PG_GETARG_POINTER, and PG_RETURN_POINTER.

271 {
273  void *out = palloc(sizeof(timeKEY));
274 
275  *(int *) PG_GETARG_POINTER(1) = sizeof(timeKEY);
276  PG_RETURN_POINTER(gbt_num_union((void *) out, entryvec, &tinfo, fcinfo->flinfo));
277 }
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
static const gbtree_ninfo tinfo
Definition: btree_time.c:125
void * palloc(Size size)
Definition: mcxt.c:848
void * gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)

◆ gbt_timeeq()

static bool gbt_timeeq ( const void *  a,
const void *  b,
FmgrInfo flinfo 
)
static

Definition at line 63 of file btree_time.c.

References DatumGetBool, DirectFunctionCall2, time_eq(), and TimeADTGetDatumFast.

64 {
65  const TimeADT *aa = (const TimeADT *) a;
66  const TimeADT *bb = (const TimeADT *) b;
67 
70  TimeADTGetDatumFast(*bb)));
71 }
#define TimeADTGetDatumFast(X)
Definition: btree_time.c:36
Datum time_eq(PG_FUNCTION_ARGS)
Definition: date.c:1439
#define DatumGetBool(X)
Definition: postgres.h:399
int64 TimeADT
Definition: date.h:24
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:587

◆ gbt_timege()

static bool gbt_timege ( const void *  a,
const void *  b,
FmgrInfo flinfo 
)
static

Definition at line 52 of file btree_time.c.

References DatumGetBool, DirectFunctionCall2, time_ge(), and TimeADTGetDatumFast.

53 {
54  const TimeADT *aa = (const TimeADT *) a;
55  const TimeADT *bb = (const TimeADT *) b;
56 
59  TimeADTGetDatumFast(*bb)));
60 }
#define TimeADTGetDatumFast(X)
Definition: btree_time.c:36
#define DatumGetBool(X)
Definition: postgres.h:399
int64 TimeADT
Definition: date.h:24
Datum time_ge(PG_FUNCTION_ARGS)
Definition: date.c:1484
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:587

◆ gbt_timegt()

static bool gbt_timegt ( const void *  a,
const void *  b,
FmgrInfo flinfo 
)
static

Definition at line 41 of file btree_time.c.

References DatumGetBool, DirectFunctionCall2, time_gt(), and TimeADTGetDatumFast.

42 {
43  const TimeADT *aa = (const TimeADT *) a;
44  const TimeADT *bb = (const TimeADT *) b;
45 
48  TimeADTGetDatumFast(*bb)));
49 }
#define TimeADTGetDatumFast(X)
Definition: btree_time.c:36
Datum time_gt(PG_FUNCTION_ARGS)
Definition: date.c:1475
#define DatumGetBool(X)
Definition: postgres.h:399
int64 TimeADT
Definition: date.h:24
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:587

◆ gbt_timekey_cmp()

static int gbt_timekey_cmp ( const void *  a,
const void *  b,
FmgrInfo flinfo 
)
static

Definition at line 98 of file btree_time.c.

References DatumGetInt32, DirectFunctionCall2, timeKEY::lower, time_cmp(), TimeADTGetDatumFast, and timeKEY::upper.

99 {
100  timeKEY *ia = (timeKEY *) (((const Nsrt *) a)->t);
101  timeKEY *ib = (timeKEY *) (((const Nsrt *) b)->t);
102  int res;
103 
105  if (res == 0)
107 
108  return res;
109 }
#define TimeADTGetDatumFast(X)
Definition: btree_time.c:36
#define DatumGetInt32(X)
Definition: postgres.h:478
TimeADT lower
Definition: btree_time.c:14
Datum time_cmp(PG_FUNCTION_ARGS)
Definition: date.c:1493
TimeADT upper
Definition: btree_time.c:15
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:587

◆ gbt_timele()

static bool gbt_timele ( const void *  a,
const void *  b,
FmgrInfo flinfo 
)
static

Definition at line 74 of file btree_time.c.

References DatumGetBool, DirectFunctionCall2, time_le(), and TimeADTGetDatumFast.

75 {
76  const TimeADT *aa = (const TimeADT *) a;
77  const TimeADT *bb = (const TimeADT *) b;
78 
81  TimeADTGetDatumFast(*bb)));
82 }
#define TimeADTGetDatumFast(X)
Definition: btree_time.c:36
Datum time_le(PG_FUNCTION_ARGS)
Definition: date.c:1466
#define DatumGetBool(X)
Definition: postgres.h:399
int64 TimeADT
Definition: date.h:24
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:587

◆ gbt_timelt()

static bool gbt_timelt ( const void *  a,
const void *  b,
FmgrInfo flinfo 
)
static

Definition at line 85 of file btree_time.c.

References DatumGetBool, DirectFunctionCall2, time_lt(), and TimeADTGetDatumFast.

86 {
87  const TimeADT *aa = (const TimeADT *) a;
88  const TimeADT *bb = (const TimeADT *) b;
89 
92  TimeADTGetDatumFast(*bb)));
93 }
#define TimeADTGetDatumFast(X)
Definition: btree_time.c:36
Datum time_lt(PG_FUNCTION_ARGS)
Definition: date.c:1457
#define DatumGetBool(X)
Definition: postgres.h:399
int64 TimeADT
Definition: date.h:24
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:587

◆ gbt_timetz_compress()

Datum gbt_timetz_compress ( PG_FUNCTION_ARGS  )

Definition at line 168 of file btree_time.c.

References DatumGetTimeTzADTP, gistentryinit, GISTENTRY::key, GISTENTRY::leafkey, timeKEY::lower, GISTENTRY::offset, GISTENTRY::page, palloc(), PG_GETARG_POINTER, PG_RETURN_POINTER, PointerGetDatum, GISTENTRY::rel, TimeTzADT::time, timeKEY::upper, and TimeTzADT::zone.

169 {
170  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
171  GISTENTRY *retval;
172 
173  if (entry->leafkey)
174  {
175  timeKEY *r = (timeKEY *) palloc(sizeof(timeKEY));
176  TimeTzADT *tz = DatumGetTimeTzADTP(entry->key);
177  TimeADT tmp;
178 
179  retval = palloc(sizeof(GISTENTRY));
180 
181  /* We are using the time + zone only to compress */
182  tmp = tz->time + (tz->zone * INT64CONST(1000000));
183  r->lower = r->upper = tmp;
184  gistentryinit(*retval, PointerGetDatum(r),
185  entry->rel, entry->page,
186  entry->offset, false);
187  }
188  else
189  retval = entry;
190  PG_RETURN_POINTER(retval);
191 }
Relation rel
Definition: gist.h:124
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:321
TimeADT time
Definition: date.h:28
#define PointerGetDatum(X)
Definition: postgres.h:562
#define DatumGetTimeTzADTP(X)
Definition: date.h:54
TimeADT lower
Definition: btree_time.c:14
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
Page page
Definition: gist.h:125
int32 zone
Definition: date.h:29
TimeADT upper
Definition: btree_time.c:15
Datum key
Definition: gist.h:123
int64 TimeADT
Definition: date.h:24
bool leafkey
Definition: gist.h:127
#define gistentryinit(e, k, r, pg, o, l)
Definition: gist.h:169
void * palloc(Size size)
Definition: mcxt.c:848
Definition: date.h:26
OffsetNumber offset
Definition: gist.h:126

◆ gbt_timetz_consistent()

Datum gbt_timetz_consistent ( PG_FUNCTION_ARGS  )

Definition at line 243 of file btree_time.c.

References DatumGetPointer, gbt_num_consistent(), GIST_LEAF, GISTENTRY::key, timeKEY::lower, GBT_NUMKEY_R::lower, PG_GETARG_POINTER, PG_GETARG_TIMETZADT_P, PG_GETARG_UINT16, PG_RETURN_BOOL, TimeTzADT::time, timeKEY::upper, GBT_NUMKEY_R::upper, and TimeTzADT::zone.

244 {
245  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
246  TimeTzADT *query = PG_GETARG_TIMETZADT_P(1);
248 
249  /* Oid subtype = PG_GETARG_OID(3); */
250  bool *recheck = (bool *) PG_GETARG_POINTER(4);
251  timeKEY *kkk = (timeKEY *) DatumGetPointer(entry->key);
252  TimeADT qqq;
253  GBT_NUMKEY_R key;
254 
255  /* All cases served by this function are inexact */
256  *recheck = true;
257 
258  qqq = query->time + (query->zone * INT64CONST(1000000));
259 
260  key.lower = (GBT_NUMKEY *) &kkk->lower;
261  key.upper = (GBT_NUMKEY *) &kkk->upper;
262 
264  gbt_num_consistent(&key, (void *) &qqq, &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)
265  );
266 }
#define GIST_LEAF(entry)
Definition: gist.h:133
const GBT_NUMKEY * lower
TimeADT time
Definition: date.h:28
TimeADT lower
Definition: btree_time.c:14
uint16 StrategyNumber
Definition: stratnum.h:22
const GBT_NUMKEY * upper
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:241
bool gbt_num_consistent(const GBT_NUMKEY_R *key, const void *query, const StrategyNumber *strategy, bool is_leaf, const gbtree_ninfo *tinfo, FmgrInfo *flinfo)
static const gbtree_ninfo tinfo
Definition: btree_time.c:125
int32 zone
Definition: date.h:29
TimeADT upper
Definition: btree_time.c:15
Datum key
Definition: gist.h:123
char GBT_NUMKEY
#define PG_GETARG_TIMETZADT_P(n)
Definition: date.h:62
int64 TimeADT
Definition: date.h:24
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:319
#define PG_GETARG_UINT16(n)
Definition: fmgr.h:237
#define DatumGetPointer(X)
Definition: postgres.h:555
Definition: date.h:26

◆ PG_FUNCTION_INFO_V1() [1/11]

PG_FUNCTION_INFO_V1 ( gbt_time_compress  )

◆ PG_FUNCTION_INFO_V1() [2/11]

PG_FUNCTION_INFO_V1 ( gbt_timetz_compress  )

◆ PG_FUNCTION_INFO_V1() [3/11]

PG_FUNCTION_INFO_V1 ( gbt_time_fetch  )

◆ PG_FUNCTION_INFO_V1() [4/11]

PG_FUNCTION_INFO_V1 ( gbt_time_union  )

◆ PG_FUNCTION_INFO_V1() [5/11]

PG_FUNCTION_INFO_V1 ( gbt_time_picksplit  )

◆ PG_FUNCTION_INFO_V1() [6/11]

PG_FUNCTION_INFO_V1 ( gbt_time_consistent  )

◆ PG_FUNCTION_INFO_V1() [7/11]

PG_FUNCTION_INFO_V1 ( gbt_time_distance  )

◆ PG_FUNCTION_INFO_V1() [8/11]

PG_FUNCTION_INFO_V1 ( gbt_timetz_consistent  )

◆ PG_FUNCTION_INFO_V1() [9/11]

PG_FUNCTION_INFO_V1 ( gbt_time_penalty  )

◆ PG_FUNCTION_INFO_V1() [10/11]

PG_FUNCTION_INFO_V1 ( gbt_time_same  )

◆ PG_FUNCTION_INFO_V1() [11/11]

PG_FUNCTION_INFO_V1 ( time_dist  )

◆ time_dist()

Datum time_dist ( PG_FUNCTION_ARGS  )

Definition at line 142 of file btree_time.c.

References abs_interval(), DatumGetIntervalP, DirectFunctionCall2, PG_GETARG_DATUM, PG_RETURN_INTERVAL_P, and time_mi_time().

143 {
145  PG_GETARG_DATUM(0),
146  PG_GETARG_DATUM(1));
147 
149 }
#define DatumGetIntervalP(X)
Definition: timestamp.h:29
#define PG_RETURN_INTERVAL_P(x)
Definition: timestamp.h:41
#define PG_GETARG_DATUM(n)
Definition: fmgr.h:233
uintptr_t Datum
Definition: postgres.h:372
Interval * abs_interval(Interval *a)
Datum time_mi_time(PG_FUNCTION_ARGS)
Definition: date.c:1796
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:587

Variable Documentation

◆ tinfo

const gbtree_ninfo tinfo
static
Initial value:
=
{
sizeof(TimeADT),
16,
}
static bool gbt_timele(const void *a, const void *b, FmgrInfo *flinfo)
Definition: btree_time.c:74
static bool gbt_timelt(const void *a, const void *b, FmgrInfo *flinfo)
Definition: btree_time.c:85
static int gbt_timekey_cmp(const void *a, const void *b, FmgrInfo *flinfo)
Definition: btree_time.c:98
static bool gbt_timegt(const void *a, const void *b, FmgrInfo *flinfo)
Definition: btree_time.c:41
int64 TimeADT
Definition: date.h:24
static float8 gbt_time_dist(const void *a, const void *b, FmgrInfo *flinfo)
Definition: btree_time.c:112
static bool gbt_timeeq(const void *a, const void *b, FmgrInfo *flinfo)
Definition: btree_time.c:63
static bool gbt_timege(const void *a, const void *b, FmgrInfo *flinfo)
Definition: btree_time.c:52

Definition at line 125 of file btree_time.c.