PostgreSQL Source Code git master
Loading...
Searching...
No Matches
nbtcompare.c File Reference
#include "postgres.h"
#include <limits.h>
#include "utils/builtins.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 btoid8cmp (PG_FUNCTION_ARGS)
 
static int btoid8fastcmp (Datum x, Datum y, SortSupport ssup)
 
Datum btoid8sortsupport (PG_FUNCTION_ARGS)
 
static Datum oid8_decrement (Relation rel, Datum existing, bool *underflow)
 
static Datum oid8_increment (Relation rel, Datum existing, bool *overflow)
 
Datum btoid8skipsupport (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 70 of file nbtcompare.c.

◆ A_LESS_THAN_B

#define A_LESS_THAN_B   (-1)

Definition at line 69 of file nbtcompare.c.

Function Documentation

◆ bool_decrement()

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

Definition at line 84 of file nbtcompare.c.

85{
87
88 if (bexisting == false)
89 {
90 /* return value is undefined */
91 *underflow = true;
92 return (Datum) 0;
93 }
94
95 *underflow = false;
96 return BoolGetDatum(bexisting - 1);
97}
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
static int fb(int x)

References BoolGetDatum(), DatumGetBool(), and fb().

Referenced by btboolskipsupport().

◆ bool_increment()

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

Definition at line 100 of file nbtcompare.c.

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

References BoolGetDatum(), DatumGetBool(), and fb().

Referenced by btboolskipsupport().

◆ btboolcmp()

Datum btboolcmp ( PG_FUNCTION_ARGS  )

Definition at line 75 of file nbtcompare.c.

76{
77 bool a = PG_GETARG_BOOL(0);
78 bool b = PG_GETARG_BOOL(1);
79
81}
int32_t int32
Definition c.h:554
#define PG_RETURN_INT32(x)
Definition fmgr.h:355
#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 116 of file nbtcompare.c.

117{
119
120 sksup->decrement = bool_decrement;
121 sksup->increment = bool_increment;
122 sksup->low_elem = BoolGetDatum(false);
123 sksup->high_elem = BoolGetDatum(true);
124
126}
#define PG_RETURN_VOID()
Definition fmgr.h:350
#define PG_GETARG_POINTER(n)
Definition fmgr.h:277
static Datum bool_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:100
static Datum bool_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:84
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 612 of file nbtcompare.c.

613{
614 char a = PG_GETARG_CHAR(0);
615 char b = PG_GETARG_CHAR(1);
616
617 /* Be careful to compare chars as unsigned */
618 PG_RETURN_INT32((int32) ((uint8) a) - (int32) ((uint8) b));
619}
uint8_t uint8
Definition c.h:556
#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 654 of file nbtcompare.c.

655{
657
658 sksup->decrement = char_decrement;
659 sksup->increment = char_increment;
660
661 /* btcharcmp compares chars as unsigned */
662 sksup->low_elem = UInt8GetDatum(0);
664
666}
static Datum char_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:622
static Datum char_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:638
static Datum UInt8GetDatum(uint8 X)
Definition postgres.h:162

References char_decrement(), char_increment(), SkipSupportData::decrement, fb(), 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 365 of file nbtcompare.c.

366{
369
370 if (a > b)
372 else if (a == b)
374 else
376}
int16_t int16
Definition c.h:553
#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:70
#define A_LESS_THAN_B
Definition nbtcompare.c:69

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 393 of file nbtcompare.c.

394{
397
398 if (a > b)
400 else if (a == b)
402 else
404}
int64_t int64
Definition c.h:555
#define PG_GETARG_INT64(n)
Definition fmgr.h:284

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 129 of file nbtcompare.c.

130{
133
135}

References a, b, PG_GETARG_INT16, and PG_RETURN_INT32.

◆ btint2fastcmp()

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

Definition at line 138 of file nbtcompare.c.

139{
142
143 return (int) a - (int) b;
144}
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(), fb(), x, and y.

Referenced by btint2sortsupport().

◆ btint2skipsupport()

Datum btint2skipsupport ( PG_FUNCTION_ARGS  )

Definition at line 188 of file nbtcompare.c.

189{
191
192 sksup->decrement = int2_decrement;
193 sksup->increment = int2_increment;
196
198}
#define PG_INT16_MIN
Definition c.h:611
#define PG_INT16_MAX
Definition c.h:612
static Datum int2_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:156
static Datum int2_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:172
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 147 of file nbtcompare.c.

148{
150
153}
static int btint2fastcmp(Datum x, Datum y, SortSupport ssup)
Definition nbtcompare.c:138
struct SortSupportData * SortSupport
Definition sortsupport.h:58
int(* comparator)(Datum x, Datum y, SortSupport ssup)

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

◆ btint42cmp()

Datum btint42cmp ( PG_FUNCTION_ARGS  )

Definition at line 379 of file nbtcompare.c.

380{
383
384 if (a > b)
386 else if (a == b)
388 else
390}

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 337 of file nbtcompare.c.

338{
341
342 if (a > b)
344 else if (a == b)
346 else
348}

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 201 of file nbtcompare.c.

202{
205
206 if (a > b)
208 else if (a == b)
210 else
212}

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 256 of file nbtcompare.c.

257{
259
260 sksup->decrement = int4_decrement;
261 sksup->increment = int4_increment;
264
266}
#define PG_INT32_MAX
Definition c.h:615
#define PG_INT32_MIN
Definition c.h:614
static Datum int4_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:240
static Datum int4_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:224
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 215 of file nbtcompare.c.

216{
218
221}
int ssup_datum_int32_cmp(Datum x, Datum y, SortSupport ssup)
Definition tuplesort.c:3436

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

◆ btint82cmp()

Datum btint82cmp ( PG_FUNCTION_ARGS  )

Definition at line 407 of file nbtcompare.c.

408{
411
412 if (a > b)
414 else if (a == b)
416 else
418}

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 351 of file nbtcompare.c.

352{
355
356 if (a > b)
358 else if (a == b)
360 else
362}

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 269 of file nbtcompare.c.

270{
273
274 if (a > b)
276 else if (a == b)
278 else
280}

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 324 of file nbtcompare.c.

325{
327
328 sksup->decrement = int8_decrement;
329 sksup->increment = int8_increment;
332
334}
#define PG_INT64_MAX
Definition c.h:618
#define PG_INT64_MIN
Definition c.h:617
static Datum int8_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:292
static Datum int8_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:308
static Datum Int64GetDatum(int64 X)
Definition postgres.h:423

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 283 of file nbtcompare.c.

284{
286
289}
int ssup_datum_signed_cmp(Datum x, Datum y, SortSupport ssup)
Definition tuplesort.c:3422

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

◆ btoid8cmp()

Datum btoid8cmp ( PG_FUNCTION_ARGS  )

Definition at line 503 of file nbtcompare.c.

504{
505 Oid8 a = PG_GETARG_OID8(0);
506 Oid8 b = PG_GETARG_OID8(1);
507
508 if (a > b)
510 else if (a == b)
512 else
514}
uint64 Oid8
Definition c.h:698
#define PG_GETARG_OID8(n)
Definition fmgr.h:276

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

◆ btoid8fastcmp()

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

Definition at line 517 of file nbtcompare.c.

518{
521
522 if (a > b)
523 return A_GREATER_THAN_B;
524 else if (a == b)
525 return 0;
526 else
527 return A_LESS_THAN_B;
528}
static Oid8 DatumGetObjectId8(Datum X)
Definition postgres.h:272

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

Referenced by btoid8sortsupport().

◆ btoid8skipsupport()

Datum btoid8skipsupport ( PG_FUNCTION_ARGS  )

Definition at line 572 of file nbtcompare.c.

573{
575
576 sksup->decrement = oid8_decrement;
577 sksup->increment = oid8_increment;
580
582}
#define InvalidOid8
Definition c.h:700
#define OID8_MAX
Definition c.h:701
static Datum oid8_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:556
static Datum oid8_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:540
static Datum ObjectId8GetDatum(Oid8 X)
Definition postgres.h:282

References SkipSupportData::decrement, SkipSupportData::high_elem, SkipSupportData::increment, InvalidOid8, SkipSupportData::low_elem, ObjectId8GetDatum(), oid8_decrement(), oid8_increment(), OID8_MAX, PG_GETARG_POINTER, and PG_RETURN_VOID.

◆ btoid8sortsupport()

Datum btoid8sortsupport ( PG_FUNCTION_ARGS  )

Definition at line 531 of file nbtcompare.c.

532{
534
537}
static int btoid8fastcmp(Datum x, Datum y, SortSupport ssup)
Definition nbtcompare.c:517

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

◆ btoidcmp()

Datum btoidcmp ( PG_FUNCTION_ARGS  )

Definition at line 421 of file nbtcompare.c.

422{
423 Oid a = PG_GETARG_OID(0);
424 Oid b = PG_GETARG_OID(1);
425
426 if (a > b)
428 else if (a == b)
430 else
432}
#define PG_GETARG_OID(n)
Definition fmgr.h:275
unsigned int Oid

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 435 of file nbtcompare.c.

436{
439
440 if (a > b)
441 return A_GREATER_THAN_B;
442 else if (a == b)
443 return 0;
444 else
445 return A_LESS_THAN_B;
446}
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 490 of file nbtcompare.c.

491{
493
494 sksup->decrement = oid_decrement;
495 sksup->increment = oid_increment;
498
500}
static Datum oid_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:474
static Datum oid_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:458
static Datum ObjectIdGetDatum(Oid X)
Definition postgres.h:262
#define InvalidOid
#define OID_MAX

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 449 of file nbtcompare.c.

450{
452
453 ssup->comparator = btoidfastcmp;
455}
static int btoidfastcmp(Datum x, Datum y, SortSupport ssup)
Definition nbtcompare.c:435

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

◆ btoidvectorcmp()

Datum btoidvectorcmp ( PG_FUNCTION_ARGS  )

Definition at line 585 of file nbtcompare.c.

586{
589 int i;
590
593
594 /* We arbitrarily choose to sort first by vector length */
595 if (a->dim1 != b->dim1)
596 PG_RETURN_INT32(a->dim1 - b->dim1);
597
598 for (i = 0; i < a->dim1; i++)
599 {
600 if (a->values[i] != b->values[i])
601 {
602 if (a->values[i] > b->values[i])
604 else
606 }
607 }
609}
int i
Definition isn.c:77
void check_valid_oidvector(const oidvector *oidArray)
Definition oid.c:118
Definition c.h:757

References a, A_GREATER_THAN_B, A_LESS_THAN_B, b, check_valid_oidvector(), 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 622 of file nbtcompare.c.

623{
625
626 if (cexisting == 0)
627 {
628 /* return value is undefined */
629 *underflow = true;
630 return (Datum) 0;
631 }
632
633 *underflow = false;
634 return CharGetDatum((uint8) cexisting - 1);
635}
static uint8 DatumGetUInt8(Datum X)
Definition postgres.h:152
static Datum CharGetDatum(char X)
Definition postgres.h:132

References CharGetDatum(), DatumGetUInt8(), and fb().

Referenced by btcharskipsupport().

◆ char_increment()

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

Definition at line 638 of file nbtcompare.c.

639{
641
642 if (cexisting == UCHAR_MAX)
643 {
644 /* return value is undefined */
645 *overflow = true;
646 return (Datum) 0;
647 }
648
649 *overflow = false;
650 return CharGetDatum((uint8) cexisting + 1);
651}

References CharGetDatum(), DatumGetUInt8(), and fb().

Referenced by btcharskipsupport().

◆ int2_decrement()

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

Definition at line 156 of file nbtcompare.c.

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

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

Referenced by btint2skipsupport().

◆ int2_increment()

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

Definition at line 172 of file nbtcompare.c.

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

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

Referenced by btint2skipsupport().

◆ int4_decrement()

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

Definition at line 224 of file nbtcompare.c.

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

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

Referenced by btint4skipsupport().

◆ int4_increment()

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

Definition at line 240 of file nbtcompare.c.

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

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

Referenced by btint4skipsupport().

◆ int8_decrement()

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

Definition at line 292 of file nbtcompare.c.

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

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

Referenced by btint8skipsupport().

◆ int8_increment()

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

Definition at line 308 of file nbtcompare.c.

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

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

Referenced by btint8skipsupport().

◆ oid8_decrement()

static Datum oid8_decrement ( Relation  rel,
Datum  existing,
bool underflow 
)
static

Definition at line 540 of file nbtcompare.c.

541{
543
544 if (oexisting == InvalidOid8)
545 {
546 /* return value is undefined */
547 *underflow = true;
548 return (Datum) 0;
549 }
550
551 *underflow = false;
552 return ObjectId8GetDatum(oexisting - 1);
553}

References DatumGetObjectId8(), fb(), InvalidOid8, and ObjectId8GetDatum().

Referenced by btoid8skipsupport().

◆ oid8_increment()

static Datum oid8_increment ( Relation  rel,
Datum  existing,
bool overflow 
)
static

Definition at line 556 of file nbtcompare.c.

557{
559
560 if (oexisting == OID8_MAX)
561 {
562 /* return value is undefined */
563 *overflow = true;
564 return (Datum) 0;
565 }
566
567 *overflow = false;
568 return ObjectId8GetDatum(oexisting + 1);
569}

References DatumGetObjectId8(), fb(), ObjectId8GetDatum(), and OID8_MAX.

Referenced by btoid8skipsupport().

◆ oid_decrement()

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

Definition at line 458 of file nbtcompare.c.

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

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

Referenced by btoidskipsupport().

◆ oid_increment()

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

Definition at line 474 of file nbtcompare.c.

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

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

Referenced by btoidskipsupport().