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)
 
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)
 
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)
 
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:679
#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 575 of file nbtcompare.c.

576{
577 char a = PG_GETARG_CHAR(0);
578 char b = PG_GETARG_CHAR(1);
579
580 /* Be careful to compare chars as unsigned */
581 PG_RETURN_INT32((int32) ((uint8) a) - (int32) ((uint8) b));
582}
uint8_t uint8
Definition c.h:681
#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 617 of file nbtcompare.c.

618{
620
621 sksup->decrement = char_decrement;
622 sksup->increment = char_increment;
623
624 /* btcharcmp compares chars as unsigned */
625 sksup->low_elem = UInt8GetDatum(0);
627
629}
static Datum char_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:585
static Datum char_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:601
static Datum UInt8GetDatum(uint8 X)
Definition postgres.h:152

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

357{
360
361 if (a > b)
363 else if (a == b)
365 else
367}
int16_t int16
Definition c.h:678
#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 384 of file nbtcompare.c.

385{
388
389 if (a > b)
391 else if (a == b)
393 else
395}
int64_t int64
Definition c.h:680
#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.

◆ btint2skipsupport()

Datum btint2skipsupport ( PG_FUNCTION_ARGS  )

Definition at line 179 of file nbtcompare.c.

180{
182
183 sksup->decrement = int2_decrement;
184 sksup->increment = int2_increment;
187
189}
#define PG_INT16_MIN
Definition c.h:728
#define PG_INT16_MAX
Definition c.h:729
static Datum int2_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:147
static Datum int2_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:163
static Datum Int16GetDatum(int16 X)
Definition postgres.h:172

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

139{
141
144}
struct SortSupportData * SortSupport
Definition execnodes.h:61
int(* comparator)(Datum x, Datum y, SortSupport ssup)
int ssup_datum_int32_cmp(Datum x, Datum y, SortSupport ssup)
Definition tuplesort.c:3475

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

◆ btint42cmp()

Datum btint42cmp ( PG_FUNCTION_ARGS  )

Definition at line 370 of file nbtcompare.c.

371{
374
375 if (a > b)
377 else if (a == b)
379 else
381}

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

329{
332
333 if (a > b)
335 else if (a == b)
337 else
339}

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

193{
196
197 if (a > b)
199 else if (a == b)
201 else
203}

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

248{
250
251 sksup->decrement = int4_decrement;
252 sksup->increment = int4_increment;
255
257}
#define PG_INT32_MAX
Definition c.h:732
#define PG_INT32_MIN
Definition c.h:731
static Datum int4_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:231
static Datum int4_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:215
static Datum Int32GetDatum(int32 X)
Definition postgres.h:212

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  )

◆ btint82cmp()

Datum btint82cmp ( PG_FUNCTION_ARGS  )

Definition at line 398 of file nbtcompare.c.

399{
402
403 if (a > b)
405 else if (a == b)
407 else
409}

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

343{
346
347 if (a > b)
349 else if (a == b)
351 else
353}

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

261{
264
265 if (a > b)
267 else if (a == b)
269 else
271}

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

316{
318
319 sksup->decrement = int8_decrement;
320 sksup->increment = int8_increment;
323
325}
#define PG_INT64_MAX
Definition c.h:735
#define PG_INT64_MIN
Definition c.h:734
static Datum int8_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:283
static Datum int8_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:299
static Datum Int64GetDatum(int64 X)
Definition postgres.h:426

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

275{
277
280}
int ssup_datum_signed_cmp(Datum x, Datum y, SortSupport ssup)
Definition tuplesort.c:3461

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

◆ btoid8cmp()

Datum btoid8cmp ( PG_FUNCTION_ARGS  )

Definition at line 480 of file nbtcompare.c.

481{
482 Oid8 a = PG_GETARG_OID8(0);
483 Oid8 b = PG_GETARG_OID8(1);
484
485 if (a > b)
487 else if (a == b)
489 else
491}
uint64 Oid8
Definition c.h:815
#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.

◆ btoid8skipsupport()

Datum btoid8skipsupport ( PG_FUNCTION_ARGS  )

Definition at line 535 of file nbtcompare.c.

536{
538
539 sksup->decrement = oid8_decrement;
540 sksup->increment = oid8_increment;
543
545}
#define InvalidOid8
Definition c.h:817
#define OID8_MAX
Definition c.h:818
static Datum oid8_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:519
static Datum oid8_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:503
static Datum ObjectId8GetDatum(Oid8 X)
Definition postgres.h:272

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

495{
497
500}
int ssup_datum_unsigned_cmp(Datum x, Datum y, SortSupport ssup)
Definition tuplesort.c:3450

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

◆ btoidcmp()

Datum btoidcmp ( PG_FUNCTION_ARGS  )

Definition at line 412 of file nbtcompare.c.

413{
414 Oid a = PG_GETARG_OID(0);
415 Oid b = PG_GETARG_OID(1);
416
417 if (a > b)
419 else if (a == b)
421 else
423}
#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.

◆ btoidskipsupport()

Datum btoidskipsupport ( PG_FUNCTION_ARGS  )

Definition at line 467 of file nbtcompare.c.

468{
470
471 sksup->decrement = oid_decrement;
472 sksup->increment = oid_increment;
475
477}
static Datum oid_increment(Relation rel, Datum existing, bool *overflow)
Definition nbtcompare.c:451
static Datum oid_decrement(Relation rel, Datum existing, bool *underflow)
Definition nbtcompare.c:435
static Datum ObjectIdGetDatum(Oid X)
Definition postgres.h:252
#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()

◆ btoidvectorcmp()

Datum btoidvectorcmp ( PG_FUNCTION_ARGS  )

Definition at line 548 of file nbtcompare.c.

549{
552 int i;
553
556
557 /* We arbitrarily choose to sort first by vector length */
558 if (a->dim1 != b->dim1)
559 PG_RETURN_INT32(a->dim1 - b->dim1);
560
561 for (i = 0; i < a->dim1; i++)
562 {
563 if (a->values[i] != b->values[i])
564 {
565 if (a->values[i] > b->values[i])
567 else
569 }
570 }
572}
int i
Definition isn.c:77
void check_valid_oidvector(const oidvector *oidArray)
Definition oid.c:118
Definition c.h:874

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

586{
588
589 if (cexisting == 0)
590 {
591 /* return value is undefined */
592 *underflow = true;
593 return (Datum) 0;
594 }
595
596 *underflow = false;
597 return CharGetDatum((uint8) cexisting - 1);
598}
static uint8 DatumGetUInt8(Datum X)
Definition postgres.h:142
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 601 of file nbtcompare.c.

602{
604
605 if (cexisting == UCHAR_MAX)
606 {
607 /* return value is undefined */
608 *overflow = true;
609 return (Datum) 0;
610 }
611
612 *overflow = false;
613 return CharGetDatum((uint8) cexisting + 1);
614}

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

Referenced by btcharskipsupport().

◆ int2_decrement()

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

Definition at line 147 of file nbtcompare.c.

148{
150
151 if (iexisting == PG_INT16_MIN)
152 {
153 /* return value is undefined */
154 *underflow = true;
155 return (Datum) 0;
156 }
157
158 *underflow = false;
159 return Int16GetDatum(iexisting - 1);
160}
static int16 DatumGetInt16(Datum X)
Definition postgres.h:162

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

164{
166
167 if (iexisting == PG_INT16_MAX)
168 {
169 /* return value is undefined */
170 *overflow = true;
171 return (Datum) 0;
172 }
173
174 *overflow = false;
175 return Int16GetDatum(iexisting + 1);
176}

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

216{
218
219 if (iexisting == PG_INT32_MIN)
220 {
221 /* return value is undefined */
222 *underflow = true;
223 return (Datum) 0;
224 }
225
226 *underflow = false;
227 return Int32GetDatum(iexisting - 1);
228}
static int32 DatumGetInt32(Datum X)
Definition postgres.h:202

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

232{
234
235 if (iexisting == PG_INT32_MAX)
236 {
237 /* return value is undefined */
238 *overflow = true;
239 return (Datum) 0;
240 }
241
242 *overflow = false;
243 return Int32GetDatum(iexisting + 1);
244}

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

284{
286
287 if (iexisting == PG_INT64_MIN)
288 {
289 /* return value is undefined */
290 *underflow = true;
291 return (Datum) 0;
292 }
293
294 *underflow = false;
295 return Int64GetDatum(iexisting - 1);
296}
static int64 DatumGetInt64(Datum X)
Definition postgres.h:416

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

300{
302
303 if (iexisting == PG_INT64_MAX)
304 {
305 /* return value is undefined */
306 *overflow = true;
307 return (Datum) 0;
308 }
309
310 *overflow = false;
311 return Int64GetDatum(iexisting + 1);
312}

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

504{
506
507 if (oexisting == InvalidOid8)
508 {
509 /* return value is undefined */
510 *underflow = true;
511 return (Datum) 0;
512 }
513
514 *underflow = false;
515 return ObjectId8GetDatum(oexisting - 1);
516}
static Oid8 DatumGetObjectId8(Datum X)
Definition postgres.h:262

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

520{
522
523 if (oexisting == OID8_MAX)
524 {
525 /* return value is undefined */
526 *overflow = true;
527 return (Datum) 0;
528 }
529
530 *overflow = false;
531 return ObjectId8GetDatum(oexisting + 1);
532}

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

436{
438
439 if (oexisting == InvalidOid)
440 {
441 /* return value is undefined */
442 *underflow = true;
443 return (Datum) 0;
444 }
445
446 *underflow = false;
447 return ObjectIdGetDatum(oexisting - 1);
448}
static Oid DatumGetObjectId(Datum X)
Definition postgres.h:242

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

452{
454
455 if (oexisting == OID_MAX)
456 {
457 /* return value is undefined */
458 *overflow = true;
459 return (Datum) 0;
460 }
461
462 *overflow = false;
463 return ObjectIdGetDatum(oexisting + 1);
464}

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

Referenced by btoidskipsupport().