Thanks to visit codestin.com
Credit goes to doxygen.postgresql.org

PostgreSQL Source Code git master
nbtcompare.c File Reference
#include "postgres.h"
#include <limits.h>
#include "utils/fmgrprotos.h"
#include "utils/skipsupport.h"
#include "utils/sortsupport.h"
Include dependency graph for nbtcompare.c:

Go to the source code of this file.

Macros

#define A_LESS_THAN_B   (-1)
 
#define A_GREATER_THAN_B   1
 

Functions

Datum btboolcmp (PG_FUNCTION_ARGS)
 
static Datum bool_decrement (Relation rel, Datum existing, bool *underflow)
 
static Datum bool_increment (Relation rel, Datum existing, bool *overflow)
 
Datum btboolskipsupport (PG_FUNCTION_ARGS)
 
Datum btint2cmp (PG_FUNCTION_ARGS)
 
static int btint2fastcmp (Datum x, Datum y, SortSupport ssup)
 
Datum btint2sortsupport (PG_FUNCTION_ARGS)
 
static Datum int2_decrement (Relation rel, Datum existing, bool *underflow)
 
static Datum int2_increment (Relation rel, Datum existing, bool *overflow)
 
Datum btint2skipsupport (PG_FUNCTION_ARGS)
 
Datum btint4cmp (PG_FUNCTION_ARGS)
 
Datum btint4sortsupport (PG_FUNCTION_ARGS)
 
static Datum int4_decrement (Relation rel, Datum existing, bool *underflow)
 
static Datum int4_increment (Relation rel, Datum existing, bool *overflow)
 
Datum btint4skipsupport (PG_FUNCTION_ARGS)
 
Datum btint8cmp (PG_FUNCTION_ARGS)
 
Datum btint8sortsupport (PG_FUNCTION_ARGS)
 
static Datum int8_decrement (Relation rel, Datum existing, bool *underflow)
 
static Datum int8_increment (Relation rel, Datum existing, bool *overflow)
 
Datum btint8skipsupport (PG_FUNCTION_ARGS)
 
Datum btint48cmp (PG_FUNCTION_ARGS)
 
Datum btint84cmp (PG_FUNCTION_ARGS)
 
Datum btint24cmp (PG_FUNCTION_ARGS)
 
Datum btint42cmp (PG_FUNCTION_ARGS)
 
Datum btint28cmp (PG_FUNCTION_ARGS)
 
Datum btint82cmp (PG_FUNCTION_ARGS)
 
Datum btoidcmp (PG_FUNCTION_ARGS)
 
static int btoidfastcmp (Datum x, Datum y, SortSupport ssup)
 
Datum btoidsortsupport (PG_FUNCTION_ARGS)
 
static Datum oid_decrement (Relation rel, Datum existing, bool *underflow)
 
static Datum oid_increment (Relation rel, Datum existing, bool *overflow)
 
Datum btoidskipsupport (PG_FUNCTION_ARGS)
 
Datum btoidvectorcmp (PG_FUNCTION_ARGS)
 
Datum btcharcmp (PG_FUNCTION_ARGS)
 
static Datum char_decrement (Relation rel, Datum existing, bool *underflow)
 
static Datum char_increment (Relation rel, Datum existing, bool *overflow)
 
Datum btcharskipsupport (PG_FUNCTION_ARGS)
 

Macro Definition Documentation

◆ A_GREATER_THAN_B

#define A_GREATER_THAN_B   1

Definition at line 69 of file nbtcompare.c.

◆ A_LESS_THAN_B

#define A_LESS_THAN_B   (-1)

Definition at line 68 of file nbtcompare.c.

Function Documentation

◆ bool_decrement()

static Datum bool_decrement ( Relation  rel,
Datum  existing,
bool *  underflow 
)
static

Definition at line 83 of file nbtcompare.c.

84{
85 bool bexisting = DatumGetBool(existing);
86
87 if (bexisting == false)
88 {
89 /* return value is undefined */
90 *underflow = true;
91 return (Datum) 0;
92 }
93
94 *underflow = false;
95 return BoolGetDatum(bexisting - 1);
96}
static bool DatumGetBool(Datum X)
Definition: postgres.h:100
static Datum BoolGetDatum(bool X)
Definition: postgres.h:112
uint64_t Datum
Definition: postgres.h:70

References BoolGetDatum(), and DatumGetBool().

Referenced by btboolskipsupport().

◆ bool_increment()

static Datum bool_increment ( Relation  rel,
Datum  existing,
bool *  overflow 
)
static

Definition at line 99 of file nbtcompare.c.

100{
101 bool bexisting = DatumGetBool(existing);
102
103 if (bexisting == true)
104 {
105 /* return value is undefined */
106 *overflow = true;
107 return (Datum) 0;
108 }
109
110 *overflow = false;
111 return BoolGetDatum(bexisting + 1);
112}

References BoolGetDatum(), and DatumGetBool().

Referenced by btboolskipsupport().

◆ btboolcmp()

Datum btboolcmp ( PG_FUNCTION_ARGS  )

Definition at line 74 of file nbtcompare.c.

75{
76 bool a = PG_GETARG_BOOL(0);
77 bool b = PG_GETARG_BOOL(1);
78
80}
int32_t int32
Definition: c.h:535
#define PG_RETURN_INT32(x)
Definition: fmgr.h:354
#define PG_GETARG_BOOL(n)
Definition: fmgr.h:274
int b
Definition: isn.c:74
int a
Definition: isn.c:73

References a, b, PG_GETARG_BOOL, and PG_RETURN_INT32.

◆ btboolskipsupport()

Datum btboolskipsupport ( PG_FUNCTION_ARGS  )

Definition at line 115 of file nbtcompare.c.

116{
118
119 sksup->decrement = bool_decrement;
120 sksup->increment = bool_increment;
121 sksup->low_elem = BoolGetDatum(false);
122 sksup->high_elem = BoolGetDatum(true);
123
125}
#define PG_RETURN_VOID()
Definition: fmgr.h:349
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:276
static Datum bool_increment(Relation rel, Datum existing, bool *overflow)
Definition: nbtcompare.c:99
static Datum bool_decrement(Relation rel, Datum existing, bool *underflow)
Definition: nbtcompare.c:83
struct SkipSupportData * SkipSupport
Definition: skipsupport.h:50
SkipSupportIncDec decrement
Definition: skipsupport.h:91
SkipSupportIncDec increment
Definition: skipsupport.h:92

References bool_decrement(), bool_increment(), BoolGetDatum(), SkipSupportData::decrement, SkipSupportData::high_elem, SkipSupportData::increment, SkipSupportData::low_elem, PG_GETARG_POINTER, and PG_RETURN_VOID.

◆ btcharcmp()

Datum btcharcmp ( PG_FUNCTION_ARGS  )

Definition at line 526 of file nbtcompare.c.

527{
528 char a = PG_GETARG_CHAR(0);
529 char b = PG_GETARG_CHAR(1);
530
531 /* Be careful to compare chars as unsigned */
532 PG_RETURN_INT32((int32) ((uint8) a) - (int32) ((uint8) b));
533}
uint8_t uint8
Definition: c.h:537
#define PG_GETARG_CHAR(n)
Definition: fmgr.h:273

References a, b, PG_GETARG_CHAR, and PG_RETURN_INT32.

◆ btcharskipsupport()

Datum btcharskipsupport ( PG_FUNCTION_ARGS  )

Definition at line 568 of file nbtcompare.c.

569{
571
572 sksup->decrement = char_decrement;
573 sksup->increment = char_increment;
574
575 /* btcharcmp compares chars as unsigned */
576 sksup->low_elem = UInt8GetDatum(0);
577 sksup->high_elem = UInt8GetDatum(UCHAR_MAX);
578
580}
static Datum char_decrement(Relation rel, Datum existing, bool *underflow)
Definition: nbtcompare.c:536
static Datum char_increment(Relation rel, Datum existing, bool *overflow)
Definition: nbtcompare.c:552
static Datum UInt8GetDatum(uint8 X)
Definition: postgres.h:162

References char_decrement(), char_increment(), SkipSupportData::decrement, SkipSupportData::high_elem, SkipSupportData::increment, SkipSupportData::low_elem, PG_GETARG_POINTER, PG_RETURN_VOID, and UInt8GetDatum().

◆ btint24cmp()

Datum btint24cmp ( PG_FUNCTION_ARGS  )

Definition at line 364 of file nbtcompare.c.

365{
368
369 if (a > b)
371 else if (a == b)
373 else
375}
int16_t int16
Definition: c.h:534
#define PG_GETARG_INT32(n)
Definition: fmgr.h:269
#define PG_GETARG_INT16(n)
Definition: fmgr.h:271
#define A_GREATER_THAN_B
Definition: nbtcompare.c:69
#define A_LESS_THAN_B
Definition: nbtcompare.c:68

References a, A_GREATER_THAN_B, A_LESS_THAN_B, b, PG_GETARG_INT16, PG_GETARG_INT32, and PG_RETURN_INT32.

◆ btint28cmp()

Datum btint28cmp ( PG_FUNCTION_ARGS  )

Definition at line 392 of file nbtcompare.c.

393{
396
397 if (a > b)
399 else if (a == b)
401 else
403}
int64_t int64
Definition: c.h:536
#define PG_GETARG_INT64(n)
Definition: fmgr.h:283

References a, A_GREATER_THAN_B, A_LESS_THAN_B, b, PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_INT32.

◆ btint2cmp()

Datum btint2cmp ( PG_FUNCTION_ARGS  )

Definition at line 128 of file nbtcompare.c.

129{
132
134}

References a, b, PG_GETARG_INT16, and PG_RETURN_INT32.

◆ btint2fastcmp()

static int btint2fastcmp ( Datum  x,
Datum  y,
SortSupport  ssup 
)
static

Definition at line 137 of file nbtcompare.c.

138{
141
142 return (int) a - (int) b;
143}
int y
Definition: isn.c:76
int x
Definition: isn.c:75
static int16 DatumGetInt16(Datum X)
Definition: postgres.h:172

References a, b, DatumGetInt16(), x, and y.

Referenced by btint2sortsupport().

◆ btint2skipsupport()

Datum btint2skipsupport ( PG_FUNCTION_ARGS  )

Definition at line 187 of file nbtcompare.c.

188{
190
191 sksup->decrement = int2_decrement;
192 sksup->increment = int2_increment;
195
197}
#define PG_INT16_MIN
Definition: c.h:591
#define PG_INT16_MAX
Definition: c.h:592
static Datum int2_decrement(Relation rel, Datum existing, bool *underflow)
Definition: nbtcompare.c:155
static Datum int2_increment(Relation rel, Datum existing, bool *overflow)
Definition: nbtcompare.c:171
static Datum Int16GetDatum(int16 X)
Definition: postgres.h:182

References SkipSupportData::decrement, SkipSupportData::high_elem, SkipSupportData::increment, Int16GetDatum(), int2_decrement(), int2_increment(), SkipSupportData::low_elem, PG_GETARG_POINTER, PG_INT16_MAX, PG_INT16_MIN, and PG_RETURN_VOID.

◆ btint2sortsupport()

Datum btint2sortsupport ( PG_FUNCTION_ARGS  )

Definition at line 146 of file nbtcompare.c.

147{
149
152}
static int btint2fastcmp(Datum x, Datum y, SortSupport ssup)
Definition: nbtcompare.c:137
struct SortSupportData * SortSupport
Definition: sortsupport.h:58
int(* comparator)(Datum x, Datum y, SortSupport ssup)
Definition: sortsupport.h:106

References btint2fastcmp(), SortSupportData::comparator, PG_GETARG_POINTER, and PG_RETURN_VOID.

◆ btint42cmp()

Datum btint42cmp ( PG_FUNCTION_ARGS  )

Definition at line 378 of file nbtcompare.c.

379{
382
383 if (a > b)
385 else if (a == b)
387 else
389}

References a, A_GREATER_THAN_B, A_LESS_THAN_B, b, PG_GETARG_INT16, PG_GETARG_INT32, and PG_RETURN_INT32.

◆ btint48cmp()

Datum btint48cmp ( PG_FUNCTION_ARGS  )

Definition at line 336 of file nbtcompare.c.

337{
340
341 if (a > b)
343 else if (a == b)
345 else
347}

References a, A_GREATER_THAN_B, A_LESS_THAN_B, b, PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_INT32.

◆ btint4cmp()

Datum btint4cmp ( PG_FUNCTION_ARGS  )

Definition at line 200 of file nbtcompare.c.

201{
204
205 if (a > b)
207 else if (a == b)
209 else
211}

References a, A_GREATER_THAN_B, A_LESS_THAN_B, b, PG_GETARG_INT32, and PG_RETURN_INT32.

◆ btint4skipsupport()

Datum btint4skipsupport ( PG_FUNCTION_ARGS  )

Definition at line 255 of file nbtcompare.c.

256{
258
259 sksup->decrement = int4_decrement;
260 sksup->increment = int4_increment;
263
265}
#define PG_INT32_MAX
Definition: c.h:595
#define PG_INT32_MIN
Definition: c.h:594
static Datum int4_increment(Relation rel, Datum existing, bool *overflow)
Definition: nbtcompare.c:239
static Datum int4_decrement(Relation rel, Datum existing, bool *underflow)
Definition: nbtcompare.c:223
static Datum Int32GetDatum(int32 X)
Definition: postgres.h:222

References SkipSupportData::decrement, SkipSupportData::high_elem, SkipSupportData::increment, Int32GetDatum(), int4_decrement(), int4_increment(), SkipSupportData::low_elem, PG_GETARG_POINTER, PG_INT32_MAX, PG_INT32_MIN, and PG_RETURN_VOID.

◆ btint4sortsupport()

Datum btint4sortsupport ( PG_FUNCTION_ARGS  )

Definition at line 214 of file nbtcompare.c.

215{
217
220}
int ssup_datum_int32_cmp(Datum x, Datum y, SortSupport ssup)
Definition: tuplesort.c:3158

References SortSupportData::comparator, PG_GETARG_POINTER, PG_RETURN_VOID, and ssup_datum_int32_cmp().

◆ btint82cmp()

Datum btint82cmp ( PG_FUNCTION_ARGS  )

Definition at line 406 of file nbtcompare.c.

407{
410
411 if (a > b)
413 else if (a == b)
415 else
417}

References a, A_GREATER_THAN_B, A_LESS_THAN_B, b, PG_GETARG_INT16, PG_GETARG_INT64, and PG_RETURN_INT32.

◆ btint84cmp()

Datum btint84cmp ( PG_FUNCTION_ARGS  )

Definition at line 350 of file nbtcompare.c.

351{
354
355 if (a > b)
357 else if (a == b)
359 else
361}

References a, A_GREATER_THAN_B, A_LESS_THAN_B, b, PG_GETARG_INT32, PG_GETARG_INT64, and PG_RETURN_INT32.

◆ btint8cmp()

Datum btint8cmp ( PG_FUNCTION_ARGS  )

Definition at line 268 of file nbtcompare.c.

269{
272
273 if (a > b)
275 else if (a == b)
277 else
279}

References a, A_GREATER_THAN_B, A_LESS_THAN_B, b, PG_GETARG_INT64, and PG_RETURN_INT32.

◆ btint8skipsupport()

Datum btint8skipsupport ( PG_FUNCTION_ARGS  )

Definition at line 323 of file nbtcompare.c.

324{
326
327 sksup->decrement = int8_decrement;
328 sksup->increment = int8_increment;
331
333}
#define PG_INT64_MAX
Definition: c.h:598
#define PG_INT64_MIN
Definition: c.h:597
static Datum int8_decrement(Relation rel, Datum existing, bool *underflow)
Definition: nbtcompare.c:291
static Datum int8_increment(Relation rel, Datum existing, bool *overflow)
Definition: nbtcompare.c:307
static Datum Int64GetDatum(int64 X)
Definition: postgres.h:403

References SkipSupportData::decrement, SkipSupportData::high_elem, SkipSupportData::increment, Int64GetDatum(), int8_decrement(), int8_increment(), SkipSupportData::low_elem, PG_GETARG_POINTER, PG_INT64_MAX, PG_INT64_MIN, and PG_RETURN_VOID.

◆ btint8sortsupport()

Datum btint8sortsupport ( PG_FUNCTION_ARGS  )

Definition at line 282 of file nbtcompare.c.

283{
285
288}
int ssup_datum_signed_cmp(Datum x, Datum y, SortSupport ssup)
Definition: tuplesort.c:3144

References SortSupportData::comparator, PG_GETARG_POINTER, PG_RETURN_VOID, and ssup_datum_signed_cmp().

◆ btoidcmp()

Datum btoidcmp ( PG_FUNCTION_ARGS  )

Definition at line 420 of file nbtcompare.c.

421{
422 Oid a = PG_GETARG_OID(0);
423 Oid b = PG_GETARG_OID(1);
424
425 if (a > b)
427 else if (a == b)
429 else
431}
#define PG_GETARG_OID(n)
Definition: fmgr.h:275
unsigned int Oid
Definition: postgres_ext.h:32

References a, A_GREATER_THAN_B, A_LESS_THAN_B, b, PG_GETARG_OID, and PG_RETURN_INT32.

◆ btoidfastcmp()

static int btoidfastcmp ( Datum  x,
Datum  y,
SortSupport  ssup 
)
static

Definition at line 434 of file nbtcompare.c.

435{
438
439 if (a > b)
440 return A_GREATER_THAN_B;
441 else if (a == b)
442 return 0;
443 else
444 return A_LESS_THAN_B;
445}
static Oid DatumGetObjectId(Datum X)
Definition: postgres.h:252

References a, A_GREATER_THAN_B, A_LESS_THAN_B, b, DatumGetObjectId(), x, and y.

Referenced by btoidsortsupport().

◆ btoidskipsupport()

Datum btoidskipsupport ( PG_FUNCTION_ARGS  )

Definition at line 489 of file nbtcompare.c.

490{
492
493 sksup->decrement = oid_decrement;
494 sksup->increment = oid_increment;
497
499}
static Datum oid_increment(Relation rel, Datum existing, bool *overflow)
Definition: nbtcompare.c:473
static Datum oid_decrement(Relation rel, Datum existing, bool *underflow)
Definition: nbtcompare.c:457
static Datum ObjectIdGetDatum(Oid X)
Definition: postgres.h:262
#define InvalidOid
Definition: postgres_ext.h:37
#define OID_MAX
Definition: postgres_ext.h:40

References SkipSupportData::decrement, SkipSupportData::high_elem, SkipSupportData::increment, InvalidOid, SkipSupportData::low_elem, ObjectIdGetDatum(), oid_decrement(), oid_increment(), OID_MAX, PG_GETARG_POINTER, and PG_RETURN_VOID.

◆ btoidsortsupport()

Datum btoidsortsupport ( PG_FUNCTION_ARGS  )

Definition at line 448 of file nbtcompare.c.

449{
451
452 ssup->comparator = btoidfastcmp;
454}
static int btoidfastcmp(Datum x, Datum y, SortSupport ssup)
Definition: nbtcompare.c:434

References btoidfastcmp(), SortSupportData::comparator, PG_GETARG_POINTER, and PG_RETURN_VOID.

◆ btoidvectorcmp()

Datum btoidvectorcmp ( PG_FUNCTION_ARGS  )

Definition at line 502 of file nbtcompare.c.

503{
506 int i;
507
508 /* We arbitrarily choose to sort first by vector length */
509 if (a->dim1 != b->dim1)
510 PG_RETURN_INT32(a->dim1 - b->dim1);
511
512 for (i = 0; i < a->dim1; i++)
513 {
514 if (a->values[i] != b->values[i])
515 {
516 if (a->values[i] > b->values[i])
518 else
520 }
521 }
523}
int i
Definition: isn.c:77
Definition: c.h:732

References a, A_GREATER_THAN_B, A_LESS_THAN_B, b, i, PG_GETARG_POINTER, and PG_RETURN_INT32.

Referenced by oidvectoreq(), oidvectorge(), oidvectorgt(), oidvectorle(), oidvectorlt(), and oidvectorne().

◆ char_decrement()

static Datum char_decrement ( Relation  rel,
Datum  existing,
bool *  underflow 
)
static

Definition at line 536 of file nbtcompare.c.

537{
538 uint8 cexisting = DatumGetUInt8(existing);
539
540 if (cexisting == 0)
541 {
542 /* return value is undefined */
543 *underflow = true;
544 return (Datum) 0;
545 }
546
547 *underflow = false;
548 return CharGetDatum((uint8) cexisting - 1);
549}
static uint8 DatumGetUInt8(Datum X)
Definition: postgres.h:152
static Datum CharGetDatum(char X)
Definition: postgres.h:132

References CharGetDatum(), and DatumGetUInt8().

Referenced by btcharskipsupport().

◆ char_increment()

static Datum char_increment ( Relation  rel,
Datum  existing,
bool *  overflow 
)
static

Definition at line 552 of file nbtcompare.c.

553{
554 uint8 cexisting = DatumGetUInt8(existing);
555
556 if (cexisting == UCHAR_MAX)
557 {
558 /* return value is undefined */
559 *overflow = true;
560 return (Datum) 0;
561 }
562
563 *overflow = false;
564 return CharGetDatum((uint8) cexisting + 1);
565}

References CharGetDatum(), and DatumGetUInt8().

Referenced by btcharskipsupport().

◆ int2_decrement()

static Datum int2_decrement ( Relation  rel,
Datum  existing,
bool *  underflow 
)
static

Definition at line 155 of file nbtcompare.c.

156{
157 int16 iexisting = DatumGetInt16(existing);
158
159 if (iexisting == PG_INT16_MIN)
160 {
161 /* return value is undefined */
162 *underflow = true;
163 return (Datum) 0;
164 }
165
166 *underflow = false;
167 return Int16GetDatum(iexisting - 1);
168}

References DatumGetInt16(), Int16GetDatum(), and PG_INT16_MIN.

Referenced by btint2skipsupport().

◆ int2_increment()

static Datum int2_increment ( Relation  rel,
Datum  existing,
bool *  overflow 
)
static

Definition at line 171 of file nbtcompare.c.

172{
173 int16 iexisting = DatumGetInt16(existing);
174
175 if (iexisting == PG_INT16_MAX)
176 {
177 /* return value is undefined */
178 *overflow = true;
179 return (Datum) 0;
180 }
181
182 *overflow = false;
183 return Int16GetDatum(iexisting + 1);
184}

References DatumGetInt16(), Int16GetDatum(), and PG_INT16_MAX.

Referenced by btint2skipsupport().

◆ int4_decrement()

static Datum int4_decrement ( Relation  rel,
Datum  existing,
bool *  underflow 
)
static

Definition at line 223 of file nbtcompare.c.

224{
225 int32 iexisting = DatumGetInt32(existing);
226
227 if (iexisting == PG_INT32_MIN)
228 {
229 /* return value is undefined */
230 *underflow = true;
231 return (Datum) 0;
232 }
233
234 *underflow = false;
235 return Int32GetDatum(iexisting - 1);
236}
static int32 DatumGetInt32(Datum X)
Definition: postgres.h:212

References DatumGetInt32(), Int32GetDatum(), and PG_INT32_MIN.

Referenced by btint4skipsupport().

◆ int4_increment()

static Datum int4_increment ( Relation  rel,
Datum  existing,
bool *  overflow 
)
static

Definition at line 239 of file nbtcompare.c.

240{
241 int32 iexisting = DatumGetInt32(existing);
242
243 if (iexisting == PG_INT32_MAX)
244 {
245 /* return value is undefined */
246 *overflow = true;
247 return (Datum) 0;
248 }
249
250 *overflow = false;
251 return Int32GetDatum(iexisting + 1);
252}

References DatumGetInt32(), Int32GetDatum(), and PG_INT32_MAX.

Referenced by btint4skipsupport().

◆ int8_decrement()

static Datum int8_decrement ( Relation  rel,
Datum  existing,
bool *  underflow 
)
static

Definition at line 291 of file nbtcompare.c.

292{
293 int64 iexisting = DatumGetInt64(existing);
294
295 if (iexisting == PG_INT64_MIN)
296 {
297 /* return value is undefined */
298 *underflow = true;
299 return (Datum) 0;
300 }
301
302 *underflow = false;
303 return Int64GetDatum(iexisting - 1);
304}
static int64 DatumGetInt64(Datum X)
Definition: postgres.h:393

References DatumGetInt64(), Int64GetDatum(), and PG_INT64_MIN.

Referenced by btint8skipsupport().

◆ int8_increment()

static Datum int8_increment ( Relation  rel,
Datum  existing,
bool *  overflow 
)
static

Definition at line 307 of file nbtcompare.c.

308{
309 int64 iexisting = DatumGetInt64(existing);
310
311 if (iexisting == PG_INT64_MAX)
312 {
313 /* return value is undefined */
314 *overflow = true;
315 return (Datum) 0;
316 }
317
318 *overflow = false;
319 return Int64GetDatum(iexisting + 1);
320}

References DatumGetInt64(), Int64GetDatum(), and PG_INT64_MAX.

Referenced by btint8skipsupport().

◆ oid_decrement()

static Datum oid_decrement ( Relation  rel,
Datum  existing,
bool *  underflow 
)
static

Definition at line 457 of file nbtcompare.c.

458{
459 Oid oexisting = DatumGetObjectId(existing);
460
461 if (oexisting == InvalidOid)
462 {
463 /* return value is undefined */
464 *underflow = true;
465 return (Datum) 0;
466 }
467
468 *underflow = false;
469 return ObjectIdGetDatum(oexisting - 1);
470}

References DatumGetObjectId(), InvalidOid, and ObjectIdGetDatum().

Referenced by btoidskipsupport().

◆ oid_increment()

static Datum oid_increment ( Relation  rel,
Datum  existing,
bool *  overflow 
)
static

Definition at line 473 of file nbtcompare.c.

474{
475 Oid oexisting = DatumGetObjectId(existing);
476
477 if (oexisting == OID_MAX)
478 {
479 /* return value is undefined */
480 *overflow = true;
481 return (Datum) 0;
482 }
483
484 *overflow = false;
485 return ObjectIdGetDatum(oexisting + 1);
486}

References DatumGetObjectId(), ObjectIdGetDatum(), and OID_MAX.

Referenced by btoidskipsupport().