PostgreSQL Source Code: src/backend/access/nbtree/nbtcompare.c Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

57

58#include <limits.h>

59

60#include "utils/fmgrprotos.h"

63

64#ifdef STRESS_SORT_INT_MIN

65#define A_LESS_THAN_B INT_MIN

66#define A_GREATER_THAN_B INT_MAX

67#else

68#define A_LESS_THAN_B (-1)

69#define A_GREATER_THAN_B 1

70#endif

71

72

75{

78

80}

81

84{

86

87 if (bexisting == false)

88 {

89

90 *underflow = true;

92 }

93

94 *underflow = false;

96}

97

100{

102

103 if (bexisting == true)

104 {

105

106 *overflow = true;

107 return (Datum) 0;

108 }

109

110 *overflow = false;

112}

113

116{

118

123

125}

126

129{

132

134}

135

136static int

138{

141

142 return (int) a - (int) b;

143}

144

147{

149

152}

153

156{

158

160 {

161

162 *underflow = true;

163 return (Datum) 0;

164 }

165

166 *underflow = false;

168}

169

172{

174

176 {

177

178 *overflow = true;

179 return (Datum) 0;

180 }

181

182 *overflow = false;

184}

185

188{

190

195

197}

198

201{

204

205 if (a > b)

207 else if (a == b)

209 else

211}

212

215{

217

220}

221

224{

226

228 {

229

230 *underflow = true;

231 return (Datum) 0;

232 }

233

234 *underflow = false;

236}

237

240{

242

244 {

245

246 *overflow = true;

247 return (Datum) 0;

248 }

249

250 *overflow = false;

252}

253

256{

258

263

265}

266

269{

272

273 if (a > b)

275 else if (a == b)

277 else

279}

280

281#if SIZEOF_DATUM < 8

282static int

284{

287

288 if (a > b)

290 else if (a == b)

291 return 0;

292 else

294}

295#endif

296

299{

301

302#if SIZEOF_DATUM >= 8

303 ssup->comparator = ssup_datum_signed_cmp;

304#else

306#endif

308}

309

312{

314

316 {

317

318 *underflow = true;

319 return (Datum) 0;

320 }

321

322 *underflow = false;

324}

325

328{

330

332 {

333

334 *overflow = true;

335 return (Datum) 0;

336 }

337

338 *overflow = false;

340}

341

344{

346

351

353}

354

357{

360

361 if (a > b)

363 else if (a == b)

365 else

367}

368

371{

374

375 if (a > b)

377 else if (a == b)

379 else

381}

382

385{

388

389 if (a > b)

391 else if (a == b)

393 else

395}

396

399{

402

403 if (a > b)

405 else if (a == b)

407 else

409}

410

413{

416

417 if (a > b)

419 else if (a == b)

421 else

423}

424

427{

430

431 if (a > b)

433 else if (a == b)

435 else

437}

438

441{

444

445 if (a > b)

447 else if (a == b)

449 else

451}

452

453static int

455{

458

459 if (a > b)

461 else if (a == b)

462 return 0;

463 else

465}

466

469{

471

474}

475

478{

480

482 {

483

484 *underflow = true;

485 return (Datum) 0;

486 }

487

488 *underflow = false;

490}

491

494{

496

497 if (oexisting == OID_MAX)

498 {

499

500 *overflow = true;

501 return (Datum) 0;

502 }

503

504 *overflow = false;

506}

507

510{

512

517

519}

520

523{

526 int i;

527

528

529 if (a->dim1 != b->dim1)

531

532 for (i = 0; i < a->dim1; i++)

533 {

534 if (a->values[i] != b->values[i])

535 {

536 if (a->values[i] > b->values[i])

538 else

540 }

541 }

543}

544

547{

550

551

553}

554

557{

559

560 if (cexisting == 0)

561 {

562

563 *underflow = true;

564 return (Datum) 0;

565 }

566

567 *underflow = false;

569}

570

573{

575

576 if (cexisting == UCHAR_MAX)

577 {

578

579 *overflow = true;

580 return (Datum) 0;

581 }

582

583 *overflow = false;

585}

586

589{

591

594

595

598

600}

Datum Int64GetDatum(int64 X)

#define PG_GETARG_CHAR(n)

#define PG_GETARG_POINTER(n)

#define PG_GETARG_INT64(n)

#define PG_RETURN_INT32(x)

#define PG_GETARG_INT32(n)

#define PG_GETARG_BOOL(n)

#define PG_GETARG_INT16(n)

Datum btoidvectorcmp(PG_FUNCTION_ARGS)

Datum btint4cmp(PG_FUNCTION_ARGS)

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

Datum btint4skipsupport(PG_FUNCTION_ARGS)

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

Datum btboolcmp(PG_FUNCTION_ARGS)

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

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

Datum btint2cmp(PG_FUNCTION_ARGS)

Datum btint24cmp(PG_FUNCTION_ARGS)

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

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

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

Datum btoidcmp(PG_FUNCTION_ARGS)

Datum btoidskipsupport(PG_FUNCTION_ARGS)

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

Datum btint2skipsupport(PG_FUNCTION_ARGS)

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

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

Datum btint84cmp(PG_FUNCTION_ARGS)

Datum btoidsortsupport(PG_FUNCTION_ARGS)

Datum btcharcmp(PG_FUNCTION_ARGS)

Datum btboolskipsupport(PG_FUNCTION_ARGS)

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

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

Datum btint8sortsupport(PG_FUNCTION_ARGS)

Datum btint82cmp(PG_FUNCTION_ARGS)

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

Datum btint8skipsupport(PG_FUNCTION_ARGS)

Datum btint48cmp(PG_FUNCTION_ARGS)

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

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

Datum btcharskipsupport(PG_FUNCTION_ARGS)

Datum btint8cmp(PG_FUNCTION_ARGS)

Datum btint4sortsupport(PG_FUNCTION_ARGS)

Datum btint42cmp(PG_FUNCTION_ARGS)

Datum btint28cmp(PG_FUNCTION_ARGS)

Datum btint2sortsupport(PG_FUNCTION_ARGS)

static bool DatumGetBool(Datum X)

static int64 DatumGetInt64(Datum X)

static Oid DatumGetObjectId(Datum X)

static Datum Int16GetDatum(int16 X)

static Datum BoolGetDatum(bool X)

static Datum ObjectIdGetDatum(Oid X)

static Datum UInt8GetDatum(uint8 X)

static Datum Int32GetDatum(int32 X)

static int16 DatumGetInt16(Datum X)

static int32 DatumGetInt32(Datum X)

static Datum CharGetDatum(char X)

struct SkipSupportData * SkipSupport

struct SortSupportData * SortSupport

SkipSupportIncDec decrement

SkipSupportIncDec increment

int(* comparator)(Datum x, Datum y, SortSupport ssup)

int ssup_datum_int32_cmp(Datum x, Datum y, SortSupport ssup)