PostgreSQL Source Code: src/backend/executor/execExprInterp.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

56

58

82

83

84

85

86

87

88#ifdef HAVE_COMPUTED_GOTO

89#define EEO_USE_COMPUTED_GOTO

90#endif

91

92

93

94

95

96

97

98

99

100

101

102#if defined(EEO_USE_COMPUTED_GOTO)

103

104

105typedef struct ExprEvalOpLookup

106{

107 const void *opcode;

109} ExprEvalOpLookup;

110

111

112static const void **dispatch_table = NULL;

113

114

115static ExprEvalOpLookup reverse_dispatch_table[EEOP_LAST];

116

117#define EEO_SWITCH()

118#define EEO_CASE(name) CASE_##name:

119#define EEO_DISPATCH() goto *((void *) op->opcode)

120#define EEO_OPCODE(opcode) ((intptr_t) dispatch_table[opcode])

121

122#else

123

124#define EEO_SWITCH() starteval: switch ((ExprEvalOp) op->opcode)

125#define EEO_CASE(name) case name:

126#define EEO_DISPATCH() goto starteval

127#define EEO_OPCODE(opcode) (opcode)

128

129#endif

130

131#define EEO_NEXT() \

132 do { \

133 op++; \

134 EEO_DISPATCH(); \

135 } while (0)

136

137#define EEO_JUMP(stepno) \

138 do { \

139 op = &state->steps[stepno]; \

140 EEO_DISPATCH(); \

141 } while (0)

142

143

146

147

152 bool *changed);

154 ExprContext *econtext, bool checkisnull);

155

156

177

178

183 int setno);

188 int setno);

190

191

192

193

194

196{

201

202#define SH_PREFIX saophash

203#define SH_ELEMENT_TYPE ScalarArrayOpExprHashEntry

204#define SH_KEY_TYPE Datum

205#define SH_SCOPE static inline

206#define SH_DECLARE

208

212

213

214

215

216

218{

219 saophash_hash *hashtab;

224

225

226#define SH_PREFIX saophash

227#define SH_ELEMENT_TYPE ScalarArrayOpExprHashEntry

228#define SH_KEY_TYPE Datum

229#define SH_KEY key

230#define SH_HASH_KEY(tb, key) saop_element_hash(tb, key)

231#define SH_EQUAL(tb, a, b) saop_hash_element_match(tb, a, b)

232#define SH_SCOPE static inline

233#define SH_STORE_HASH

234#define SH_GET_HASH(tb, a) a->hash

235#define SH_DEFINE

237

238

239

240

241void

243{

244

246

247

251

252

253

254

255

256

258 return;

259

260

261

262

263

264

265

267

268

270

271

272

273

274

275

277

278

279

280

281

282

283 if (state->steps_len == 5)

284 {

289

294 {

296 return;

297 }

298 }

299 else if (state->steps_len == 4)

300 {

304

308 {

310 return;

311 }

315 {

317 return;

318 }

322 {

324 return;

325 }

326 }

327 else if (state->steps_len == 3)

328 {

331

334 {

336 return;

337 }

340 {

342 return;

343 }

346 {

348 return;

349 }

352 {

354 return;

355 }

358 {

360 return;

361 }

364 {

366 return;

367 }

372 {

374 return;

375 }

378 {

380 return;

381 }

384 {

386 return;

387 }

388 }

389 else if (state->steps_len == 2)

390 {

392

394 {

396 return;

397 }

399 {

401 return;

402 }

404 {

406 return;

407 }

409 {

411 return;

412 }

414 {

416 return;

417 }

419 {

421 return;

422 }

424 {

426 return;

427 }

428 }

429

430#if defined(EEO_USE_COMPUTED_GOTO)

431

432

433

434

435

436 for (int off = 0; off < state->steps_len; off++)

437 {

439

441 }

442

444#endif

445

447}

448

449

450

451

452

453

454

455

456

457

458

461{

469

470

471

472

473#if defined(EEO_USE_COMPUTED_GOTO)

474 static const void *const dispatch_table[] = {

475 &&CASE_EEOP_DONE_RETURN,

476 &&CASE_EEOP_DONE_NO_RETURN,

477 &&CASE_EEOP_INNER_FETCHSOME,

478 &&CASE_EEOP_OUTER_FETCHSOME,

479 &&CASE_EEOP_SCAN_FETCHSOME,

480 &&CASE_EEOP_OLD_FETCHSOME,

481 &&CASE_EEOP_NEW_FETCHSOME,

482 &&CASE_EEOP_INNER_VAR,

483 &&CASE_EEOP_OUTER_VAR,

484 &&CASE_EEOP_SCAN_VAR,

485 &&CASE_EEOP_OLD_VAR,

486 &&CASE_EEOP_NEW_VAR,

487 &&CASE_EEOP_INNER_SYSVAR,

488 &&CASE_EEOP_OUTER_SYSVAR,

489 &&CASE_EEOP_SCAN_SYSVAR,

490 &&CASE_EEOP_OLD_SYSVAR,

491 &&CASE_EEOP_NEW_SYSVAR,

492 &&CASE_EEOP_WHOLEROW,

493 &&CASE_EEOP_ASSIGN_INNER_VAR,

494 &&CASE_EEOP_ASSIGN_OUTER_VAR,

495 &&CASE_EEOP_ASSIGN_SCAN_VAR,

496 &&CASE_EEOP_ASSIGN_OLD_VAR,

497 &&CASE_EEOP_ASSIGN_NEW_VAR,

498 &&CASE_EEOP_ASSIGN_TMP,

499 &&CASE_EEOP_ASSIGN_TMP_MAKE_RO,

500 &&CASE_EEOP_CONST,

501 &&CASE_EEOP_FUNCEXPR,

502 &&CASE_EEOP_FUNCEXPR_STRICT,

503 &&CASE_EEOP_FUNCEXPR_STRICT_1,

504 &&CASE_EEOP_FUNCEXPR_STRICT_2,

505 &&CASE_EEOP_FUNCEXPR_FUSAGE,

506 &&CASE_EEOP_FUNCEXPR_STRICT_FUSAGE,

507 &&CASE_EEOP_BOOL_AND_STEP_FIRST,

508 &&CASE_EEOP_BOOL_AND_STEP,

509 &&CASE_EEOP_BOOL_AND_STEP_LAST,

510 &&CASE_EEOP_BOOL_OR_STEP_FIRST,

511 &&CASE_EEOP_BOOL_OR_STEP,

512 &&CASE_EEOP_BOOL_OR_STEP_LAST,

513 &&CASE_EEOP_BOOL_NOT_STEP,

514 &&CASE_EEOP_QUAL,

515 &&CASE_EEOP_JUMP,

516 &&CASE_EEOP_JUMP_IF_NULL,

517 &&CASE_EEOP_JUMP_IF_NOT_NULL,

518 &&CASE_EEOP_JUMP_IF_NOT_TRUE,

519 &&CASE_EEOP_NULLTEST_ISNULL,

520 &&CASE_EEOP_NULLTEST_ISNOTNULL,

521 &&CASE_EEOP_NULLTEST_ROWISNULL,

522 &&CASE_EEOP_NULLTEST_ROWISNOTNULL,

523 &&CASE_EEOP_BOOLTEST_IS_TRUE,

524 &&CASE_EEOP_BOOLTEST_IS_NOT_TRUE,

525 &&CASE_EEOP_BOOLTEST_IS_FALSE,

526 &&CASE_EEOP_BOOLTEST_IS_NOT_FALSE,

527 &&CASE_EEOP_PARAM_EXEC,

528 &&CASE_EEOP_PARAM_EXTERN,

529 &&CASE_EEOP_PARAM_CALLBACK,

530 &&CASE_EEOP_PARAM_SET,

531 &&CASE_EEOP_CASE_TESTVAL,

532 &&CASE_EEOP_CASE_TESTVAL_EXT,

533 &&CASE_EEOP_MAKE_READONLY,

534 &&CASE_EEOP_IOCOERCE,

535 &&CASE_EEOP_IOCOERCE_SAFE,

536 &&CASE_EEOP_DISTINCT,

537 &&CASE_EEOP_NOT_DISTINCT,

538 &&CASE_EEOP_NULLIF,

539 &&CASE_EEOP_SQLVALUEFUNCTION,

540 &&CASE_EEOP_CURRENTOFEXPR,

541 &&CASE_EEOP_NEXTVALUEEXPR,

542 &&CASE_EEOP_RETURNINGEXPR,

543 &&CASE_EEOP_ARRAYEXPR,

544 &&CASE_EEOP_ARRAYCOERCE,

545 &&CASE_EEOP_ROW,

546 &&CASE_EEOP_ROWCOMPARE_STEP,

547 &&CASE_EEOP_ROWCOMPARE_FINAL,

548 &&CASE_EEOP_MINMAX,

549 &&CASE_EEOP_FIELDSELECT,

550 &&CASE_EEOP_FIELDSTORE_DEFORM,

551 &&CASE_EEOP_FIELDSTORE_FORM,

552 &&CASE_EEOP_SBSREF_SUBSCRIPTS,

553 &&CASE_EEOP_SBSREF_OLD,

554 &&CASE_EEOP_SBSREF_ASSIGN,

555 &&CASE_EEOP_SBSREF_FETCH,

556 &&CASE_EEOP_DOMAIN_TESTVAL,

557 &&CASE_EEOP_DOMAIN_TESTVAL_EXT,

558 &&CASE_EEOP_DOMAIN_NOTNULL,

559 &&CASE_EEOP_DOMAIN_CHECK,

560 &&CASE_EEOP_HASHDATUM_SET_INITVAL,

561 &&CASE_EEOP_HASHDATUM_FIRST,

562 &&CASE_EEOP_HASHDATUM_FIRST_STRICT,

563 &&CASE_EEOP_HASHDATUM_NEXT32,

564 &&CASE_EEOP_HASHDATUM_NEXT32_STRICT,

565 &&CASE_EEOP_CONVERT_ROWTYPE,

566 &&CASE_EEOP_SCALARARRAYOP,

567 &&CASE_EEOP_HASHED_SCALARARRAYOP,

568 &&CASE_EEOP_XMLEXPR,

569 &&CASE_EEOP_JSON_CONSTRUCTOR,

570 &&CASE_EEOP_IS_JSON,

571 &&CASE_EEOP_JSONEXPR_PATH,

572 &&CASE_EEOP_JSONEXPR_COERCION,

573 &&CASE_EEOP_JSONEXPR_COERCION_FINISH,

574 &&CASE_EEOP_AGGREF,

575 &&CASE_EEOP_GROUPING_FUNC,

576 &&CASE_EEOP_WINDOW_FUNC,

577 &&CASE_EEOP_MERGE_SUPPORT_FUNC,

578 &&CASE_EEOP_SUBPLAN,

579 &&CASE_EEOP_AGG_STRICT_DESERIALIZE,

580 &&CASE_EEOP_AGG_DESERIALIZE,

581 &&CASE_EEOP_AGG_STRICT_INPUT_CHECK_ARGS,

582 &&CASE_EEOP_AGG_STRICT_INPUT_CHECK_ARGS_1,

583 &&CASE_EEOP_AGG_STRICT_INPUT_CHECK_NULLS,

584 &&CASE_EEOP_AGG_PLAIN_PERGROUP_NULLCHECK,

585 &&CASE_EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL,

586 &&CASE_EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL,

587 &&CASE_EEOP_AGG_PLAIN_TRANS_BYVAL,

588 &&CASE_EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYREF,

589 &&CASE_EEOP_AGG_PLAIN_TRANS_STRICT_BYREF,

590 &&CASE_EEOP_AGG_PLAIN_TRANS_BYREF,

591 &&CASE_EEOP_AGG_PRESORTED_DISTINCT_SINGLE,

592 &&CASE_EEOP_AGG_PRESORTED_DISTINCT_MULTI,

593 &&CASE_EEOP_AGG_ORDERED_TRANS_DATUM,

594 &&CASE_EEOP_AGG_ORDERED_TRANS_TUPLE,

595 &&CASE_EEOP_LAST

596 };

597

599 "dispatch_table out of whack with ExprEvalOp");

600

603#else

605#endif

606

607

609 resultslot = state->resultslot;

615

616#if defined(EEO_USE_COMPUTED_GOTO)

618#endif

619

621 {

623 {

625 return state->resvalue;

626 }

627

629 {

631 return (Datum) 0;

632 }

633

635 {

637

639

641 }

642

644 {

646

648

650 }

651

653 {

655

657

659 }

660

662 {

664

666

668 }

669

671 {

673

675

677 }

678

680 {

681 int attnum = op->d.var.attnum;

682

683

684

685

686

687

688

689 Assert(attnum >= 0 && attnum < innerslot->tts_nvalid);

692

694 }

695

697 {

698 int attnum = op->d.var.attnum;

699

700

701

702 Assert(attnum >= 0 && attnum < outerslot->tts_nvalid);

705

707 }

708

710 {

711 int attnum = op->d.var.attnum;

712

713

714

715 Assert(attnum >= 0 && attnum < scanslot->tts_nvalid);

718

720 }

721

723 {

724 int attnum = op->d.var.attnum;

725

726

727

728 Assert(attnum >= 0 && attnum < oldslot->tts_nvalid);

731

733 }

734

736 {

737 int attnum = op->d.var.attnum;

738

739

740

741 Assert(attnum >= 0 && attnum < newslot->tts_nvalid);

744

746 }

747

749 {

752 }

753

755 {

758 }

759

761 {

764 }

765

767 {

770 }

771

773 {

776 }

777

779 {

780

782

784 }

785

787 {

788 int resultnum = op->d.assign_var.resultnum;

789 int attnum = op->d.assign_var.attnum;

790

791

792

793

794

795 Assert(attnum >= 0 && attnum < innerslot->tts_nvalid);

796 Assert(resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);

799

801 }

802

804 {

805 int resultnum = op->d.assign_var.resultnum;

806 int attnum = op->d.assign_var.attnum;

807

808

809

810

811

812 Assert(attnum >= 0 && attnum < outerslot->tts_nvalid);

813 Assert(resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);

816

818 }

819

821 {

822 int resultnum = op->d.assign_var.resultnum;

823 int attnum = op->d.assign_var.attnum;

824

825

826

827

828

829 Assert(attnum >= 0 && attnum < scanslot->tts_nvalid);

830 Assert(resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);

833

835 }

836

838 {

839 int resultnum = op->d.assign_var.resultnum;

840 int attnum = op->d.assign_var.attnum;

841

842

843

844

845

846 Assert(attnum >= 0 && attnum < oldslot->tts_nvalid);

847 Assert(resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);

850

852 }

853

855 {

856 int resultnum = op->d.assign_var.resultnum;

857 int attnum = op->d.assign_var.attnum;

858

859

860

861

862

863 Assert(attnum >= 0 && attnum < newslot->tts_nvalid);

864 Assert(resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);

867

869 }

870

872 {

873 int resultnum = op->d.assign_tmp.resultnum;

874

875 Assert(resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);

878

880 }

881

883 {

884 int resultnum = op->d.assign_tmp.resultnum;

885

886 Assert(resultnum >= 0 && resultnum < resultslot->tts_tupleDescriptor->natts);

891 else

893

895 }

896

898 {

899 *op->resnull = op->d.constval.isnull;

900 *op->resvalue = op->d.constval.value;

901

903 }

904

905

906

907

908

909

910

911

912

913

914

915

916

917

918

919

921 {

924

925 fcinfo->isnull = false;

926 d = op->d.func.fn_addr(fcinfo);

927 *op->resvalue = d;

928 *op->resnull = fcinfo->isnull;

929

931 }

932

933

935 {

938 int nargs = op->d.func.nargs;

940

942

943

944 for (int argno = 0; argno < nargs; argno++)

945 {

947 {

948 *op->resnull = true;

949 goto strictfail;

950 }

951 }

952 fcinfo->isnull = false;

953 d = op->d.func.fn_addr(fcinfo);

954 *op->resvalue = d;

955 *op->resnull = fcinfo->isnull;

956

957 strictfail:

959 }

960

961

963 {

966

967 Assert(op->d.func.nargs == 1);

968

969

971 *op->resnull = true;

972 else

973 {

975

976 fcinfo->isnull = false;

977 d = op->d.func.fn_addr(fcinfo);

978 *op->resvalue = d;

979 *op->resnull = fcinfo->isnull;

980 }

981

983 }

984

985

987 {

990

991 Assert(op->d.func.nargs == 2);

992

993

995 *op->resnull = true;

996 else

997 {

999

1000 fcinfo->isnull = false;

1001 d = op->d.func.fn_addr(fcinfo);

1002 *op->resvalue = d;

1003 *op->resnull = fcinfo->isnull;

1004 }

1005

1007 }

1008

1010 {

1011

1013

1015 }

1016

1018 {

1019

1021

1023 }

1024

1025

1026

1027

1028

1029

1030

1031

1032

1033

1034

1036 {

1037 *op->d.boolexpr.anynull = false;

1038

1039

1040

1041

1042

1043

1044

1045 }

1046

1048 {

1049 if (*op->resnull)

1050 {

1051 *op->d.boolexpr.anynull = true;

1052 }

1054 {

1055

1056

1058 }

1059

1061 }

1062

1064 {

1065 if (*op->resnull)

1066 {

1067

1068 }

1070 {

1071

1072

1073

1074

1075

1076

1077

1078 }

1079 else if (*op->d.boolexpr.anynull)

1080 {

1081 *op->resvalue = (Datum) 0;

1082 *op->resnull = true;

1083 }

1084 else

1085 {

1086

1087 }

1088

1090 }

1091

1092

1093

1094

1095

1096

1097

1098

1099

1100

1101

1103 {

1104 *op->d.boolexpr.anynull = false;

1105

1106

1107

1108

1109

1110

1111

1112 }

1113

1115 {

1116 if (*op->resnull)

1117 {

1118 *op->d.boolexpr.anynull = true;

1119 }

1121 {

1122

1123

1125 }

1126

1128 }

1129

1131 {

1132 if (*op->resnull)

1133 {

1134

1135 }

1137 {

1138

1139

1140

1141

1142

1143

1144

1145 }

1146 else if (*op->d.boolexpr.anynull)

1147 {

1148 *op->resvalue = (Datum) 0;

1149 *op->resnull = true;

1150 }

1151 else

1152 {

1153

1154 }

1155

1157 }

1158

1160 {

1161

1162

1163

1164

1165

1166

1168

1170 }

1171

1173 {

1174

1175

1176

1177 if (*op->resnull ||

1179 {

1180

1181 *op->resnull = false;

1184 }

1185

1186

1187

1188

1189

1190

1192 }

1193

1195 {

1196

1198 }

1199

1201 {

1202

1203 if (*op->resnull)

1205

1207 }

1208

1210 {

1211

1212 if (!*op->resnull)

1214

1216 }

1217

1219 {

1220

1223

1225 }

1226

1228 {

1230 *op->resnull = false;

1231

1233 }

1234

1236 {

1238 *op->resnull = false;

1239

1241 }

1242

1244 {

1245

1247

1249 }

1250

1252 {

1253

1255

1257 }

1258

1259

1260

1262 {

1263 if (*op->resnull)

1264 {

1266 *op->resnull = false;

1267 }

1268

1269

1271 }

1272

1274 {

1275 if (*op->resnull)

1276 {

1278 *op->resnull = false;

1279 }

1280 else

1282

1284 }

1285

1287 {

1288 if (*op->resnull)

1289 {

1291 *op->resnull = false;

1292 }

1293 else

1295

1297 }

1298

1300 {

1301 if (*op->resnull)

1302 {

1304 *op->resnull = false;

1305 }

1306

1307

1309 }

1310

1312 {

1313

1315

1317 }

1318

1320 {

1321

1324 }

1325

1327 {

1328

1329 op->d.cparam.paramfunc(state, op, econtext);

1331 }

1332

1334 {

1335

1338 }

1339

1341 {

1342 *op->resvalue = *op->d.casetest.value;

1343 *op->resnull = *op->d.casetest.isnull;

1344

1346 }

1347

1349 {

1352

1354 }

1355

1357 {

1358

1359

1360

1361 if (!*op->d.make_readonly.isnull)

1362 *op->resvalue =

1364 *op->resnull = *op->d.make_readonly.isnull;

1365

1367 }

1368

1370 {

1371

1372

1373

1374

1375

1376

1377

1378

1379 char *str;

1380

1381

1382 if (*op->resnull)

1383 {

1384

1385 str = NULL;

1386 }

1387 else

1388 {

1390

1391 fcinfo_out = op->d.iocoerce.fcinfo_data_out;

1392 fcinfo_out->args[0].value = *op->resvalue;

1394

1395 fcinfo_out->isnull = false;

1397

1398

1400 }

1401

1402

1403 if (op->d.iocoerce.finfo_in->fn_strict || str != NULL)

1404 {

1407

1408 fcinfo_in = op->d.iocoerce.fcinfo_data_in;

1411

1412

1413 fcinfo_in->isnull = false;

1415 *op->resvalue = d;

1416

1417

1418 if (str == NULL)

1419 {

1422 }

1423 else

1424 {

1427 }

1428 }

1429

1431 }

1432

1434 {

1437 }

1438

1440 {

1441

1442

1443

1444

1445

1446

1447

1448

1449

1451

1452

1454 {

1455

1457 *op->resnull = false;

1458 }

1460 {

1461

1463 *op->resnull = false;

1464 }

1465 else

1466 {

1467

1469

1470 fcinfo->isnull = false;

1471 eqresult = op->d.func.fn_addr(fcinfo);

1472

1474 *op->resnull = fcinfo->isnull;

1475 }

1476

1478 }

1479

1480

1482 {

1484

1486 {

1488 *op->resnull = false;

1489 }

1491 {

1493 *op->resnull = false;

1494 }

1495 else

1496 {

1498

1499 fcinfo->isnull = false;

1500 eqresult = op->d.func.fn_addr(fcinfo);

1501 *op->resvalue = eqresult;

1502 *op->resnull = fcinfo->isnull;

1503 }

1504

1506 }

1507

1509 {

1510

1511

1512

1515

1516

1518 {

1520

1521

1522

1523

1524

1525

1526

1527

1528 if (op->d.func.make_ro)

1531

1532 fcinfo->isnull = false;

1533 result = op->d.func.fn_addr(fcinfo);

1534

1535

1537 {

1538 *op->resvalue = (Datum) 0;

1539 *op->resnull = true;

1540

1542 }

1543 }

1544

1545

1546 *op->resvalue = save_arg0;

1548

1550 }

1551

1553 {

1554

1555

1556

1557

1559

1561 }

1562

1564 {

1565

1567

1569 }

1570

1572 {

1573

1574

1575

1576

1578

1580 }

1581

1583 {

1584

1585

1586

1587

1588 if (state->flags & op->d.returningexpr.nullflag)

1589 {

1590 *op->resvalue = (Datum) 0;

1591 *op->resnull = true;

1592

1593 EEO_JUMP(op->d.returningexpr.jumpdone);

1594 }

1595

1597 }

1598

1600 {

1601

1603

1605 }

1606

1608 {

1609

1611

1613 }

1614

1616 {

1617

1619

1621 }

1622

1624 {

1627

1628

1629 if (op->d.rowcompare_step.finfo->fn_strict &&

1631 {

1632 *op->resnull = true;

1633 EEO_JUMP(op->d.rowcompare_step.jumpnull);

1634 }

1635

1636

1637 fcinfo->isnull = false;

1638 d = op->d.rowcompare_step.fn_addr(fcinfo);

1639 *op->resvalue = d;

1640

1641

1643 {

1644 *op->resnull = true;

1645 EEO_JUMP(op->d.rowcompare_step.jumpnull);

1646 }

1647 *op->resnull = false;

1648

1649

1651 {

1652 EEO_JUMP(op->d.rowcompare_step.jumpdone);

1653 }

1654

1656 }

1657

1659 {

1662

1663 *op->resnull = false;

1665 {

1666

1669 break;

1672 break;

1675 break;

1678 break;

1679 default:

1681 break;

1682 }

1683

1685 }

1686

1688 {

1689

1691

1693 }

1694

1696 {

1697

1699

1701 }

1702

1704 {

1705

1707

1709 }

1710

1712 {

1713

1715

1717 }

1718

1720 {

1721

1722 if (op->d.sbsref_subscript.subscriptfunc(state, op, econtext))

1723 {

1725 }

1726 else

1727 {

1728

1729 EEO_JUMP(op->d.sbsref_subscript.jumpdone);

1730 }

1731 }

1732

1736 {

1737

1738 op->d.sbsref.subscriptfunc(state, op, econtext);

1739

1741 }

1742

1744 {

1745

1747

1749 }

1750

1752 {

1753

1755

1757 }

1758

1760 {

1761

1763

1765 }

1766

1768 {

1769 *op->resvalue = *op->d.casetest.value;

1770 *op->resnull = *op->d.casetest.isnull;

1771

1773 }

1774

1776 {

1779

1781 }

1782

1784 {

1785

1787

1789 }

1790

1792 {

1793

1795

1797 }

1798

1800 {

1801 *op->resvalue = op->d.hashdatum_initvalue.init_value;

1802 *op->resnull = false;

1803

1805 }

1806

1808 {

1810

1811

1812

1813

1814

1816 *op->resvalue = op->d.hashdatum.fn_addr(fcinfo);

1817 else

1818 *op->resvalue = (Datum) 0;

1819

1820 *op->resnull = false;

1821

1823 }

1824

1826 {

1828

1830 {

1831

1832

1833

1834

1835

1836 *op->resnull = true;

1837 *op->resvalue = (Datum) 0;

1839 }

1840

1841

1842 *op->resvalue = op->d.hashdatum.fn_addr(fcinfo);

1843 *op->resnull = false;

1844

1846 }

1847

1849 {

1851 uint32 existinghash;

1852

1853 existinghash = DatumGetUInt32(op->d.hashdatum.iresult->value);

1854

1856

1857

1859 {

1861

1862

1863 hashvalue = DatumGetUInt32(op->d.hashdatum.fn_addr(fcinfo));

1864 existinghash = existinghash ^ hashvalue;

1865 }

1866

1868 *op->resnull = false;

1869

1871 }

1872

1874 {

1876

1878 {

1879

1880

1881

1882

1883

1884 *op->resnull = true;

1885 *op->resvalue = (Datum) 0;

1887 }

1888 else

1889 {

1890 uint32 existinghash;

1892

1893 existinghash = DatumGetUInt32(op->d.hashdatum.iresult->value);

1894

1896

1897

1898 hashvalue = DatumGetUInt32(op->d.hashdatum.fn_addr(fcinfo));

1900 *op->resnull = false;

1901 }

1902

1904 }

1905

1907 {

1908

1910

1912 }

1913

1915 {

1916

1919 }

1920

1922 {

1923

1925

1927 }

1928

1930 {

1931

1933 }

1934

1936 {

1937

1939

1941 }

1942

1944 {

1945

1947

1949 }

1950

1952 {

1953

1954

1955

1956

1957 int aggno = op->d.aggref.aggno;

1958

1960

1963

1965 }

1966

1968 {

1969

1971

1973 }

1974

1976 {

1977

1978

1979

1981

1983

1986

1988 }

1989

1991 {

1992

1994

1996 }

1997

1999 {

2000

2002

2004 }

2005

2006

2008 {

2009

2010 if (op->d.agg_deserialize.fcinfo_data->args[0].isnull)

2011 EEO_JUMP(op->d.agg_deserialize.jumpnull);

2012

2013

2014 }

2015

2016

2018 {

2022

2023

2024

2025

2026

2028 fcinfo->isnull = false;

2030 *op->resnull = fcinfo->isnull;

2032

2034 }

2035

2036

2037

2038

2039

2040

2041

2043 {

2045 int nargs = op->d.agg_strict_input_check.nargs;

2046

2048

2049 for (int argno = 0; argno < nargs; argno++)

2050 {

2052 EEO_JUMP(op->d.agg_strict_input_check.jumpnull);

2053 }

2055 }

2056

2057

2059 {

2062

2064

2066 EEO_JUMP(op->d.agg_strict_input_check.jumpnull);

2068 }

2069

2071 {

2072 bool *nulls = op->d.agg_strict_input_check.nulls;

2073 int nargs = op->d.agg_strict_input_check.nargs;

2074

2075 for (int argno = 0; argno < nargs; argno++)

2076 {

2077 if (nulls[argno])

2078 EEO_JUMP(op->d.agg_strict_input_check.jumpnull);

2079 }

2081 }

2082

2083

2084

2085

2086

2088 {

2091 aggstate->all_pergroups[op->d.agg_plain_pergroup_nullcheck.setoff];

2092

2093 if (pergroup_allaggs == NULL)

2094 EEO_JUMP(op->d.agg_plain_pergroup_nullcheck.jumpnull);

2095

2097 }

2098

2099

2100

2101

2102

2103

2104

2105

2106

2107

2108

2109

2110

2112 {

2116 &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];

2117

2119

2121 {

2122

2124 op->d.agg_trans.aggcontext);

2125

2126 }

2128 {

2129

2131 op->d.agg_trans.aggcontext,

2132 op->d.agg_trans.setno);

2133 }

2134

2136 }

2137

2138

2140 {

2144 &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];

2145

2147

2150 op->d.agg_trans.aggcontext,

2151 op->d.agg_trans.setno);

2152

2154 }

2155

2156

2158 {

2162 &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];

2163

2165

2167 op->d.agg_trans.aggcontext,

2168 op->d.agg_trans.setno);

2169

2171 }

2172

2173

2175 {

2179 &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];

2180

2182

2185 op->d.agg_trans.aggcontext);

2188 op->d.agg_trans.aggcontext,

2189 op->d.agg_trans.setno);

2190

2192 }

2193

2194

2196 {

2200 &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];

2201

2203

2206 op->d.agg_trans.aggcontext,

2207 op->d.agg_trans.setno);

2209 }

2210

2211

2213 {

2217 &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];

2218

2220

2222 op->d.agg_trans.aggcontext,

2223 op->d.agg_trans.setno);

2224

2226 }

2227

2229 {

2232

2235 else

2236 EEO_JUMP(op->d.agg_presorted_distinctcheck.jumpdistinct);

2237 }

2238

2240 {

2243

2246 else

2247 EEO_JUMP(op->d.agg_presorted_distinctcheck.jumpdistinct);

2248 }

2249

2250

2252 {

2253

2255

2257 }

2258

2259

2261 {

2262

2264

2266 }

2267

2269 {

2270

2272 goto out_error;

2273 }

2274 }

2275

2276out_error:

2278 return (Datum) 0;

2279}

2280

2281

2282

2283

2284

2285

2288{

2289

2290

2291

2292

2294

2295

2297

2298

2299 return state->evalfunc(state, econtext, isNull);

2300}

2301

2302

2303

2304

2305

2306void

2308{

2314

2320

2321 for (int i = 0; i < state->steps_len; i++)

2322 {

2324

2326 {

2328 {

2329 int attnum = op->d.var.attnum;

2330

2332 break;

2333 }

2334

2336 {

2337 int attnum = op->d.var.attnum;

2338

2340 break;

2341 }

2342

2344 {

2345 int attnum = op->d.var.attnum;

2346

2348 break;

2349 }

2350

2352 {

2353 int attnum = op->d.var.attnum;

2354

2356 break;

2357 }

2358

2360 {

2361 int attnum = op->d.var.attnum;

2362

2364 break;

2365 }

2366 default:

2367 break;

2368 }

2369 }

2370}

2371

2372

2373

2374

2375

2376

2377static void

2379{

2380

2381

2382

2383

2384

2385

2386

2387

2388

2389

2390

2391

2392

2393

2394

2395

2396

2398 {

2401

2402 if (attnum > slot_tupdesc->natts)

2403 elog(ERROR, "attribute number %d exceeds number of columns %d",

2405

2407

2408

2409 if (attr->attgenerated == ATTRIBUTE_GENERATED_VIRTUAL)

2410 elog(ERROR, "unexpected virtual generated column reference");

2411

2412 if (attr->attisdropped)

2414 (errcode(ERRCODE_UNDEFINED_COLUMN),

2415 errmsg("attribute %d of type %s has been dropped",

2417

2418 if (vartype != attr->atttypid)

2420 (errcode(ERRCODE_DATATYPE_MISMATCH),

2421 errmsg("attribute %d of type %s has wrong type",

2423 errdetail("Table has type %s, but query expects %s.",

2426 }

2427}

2428

2429

2430

2431

2432static void

2434{

2435#ifdef USE_ASSERT_CHECKING

2436

2437 if (op->d.fetch.fixed)

2438 return;

2439

2440

2441

2442

2443

2446 return;

2449 return;

2450

2451

2452

2453

2454

2456 return;

2457

2459#endif

2460}

2461

2462

2463

2464

2465

2466

2467

2468

2469

2470

2471

2472

2473

2474

2475

2476

2477

2478

2482 bool *changed)

2483{

2484 if (type_id != RECORDOID)

2485 {

2486

2487

2488

2489

2490

2491

2492

2494

2498 {

2500 if (typentry->tupDesc == NULL)

2502 (errcode(ERRCODE_WRONG_OBJECT_TYPE),

2503 errmsg("type %s is not composite",

2507 if (changed)

2508 *changed = true;

2509 }

2510 return typentry->tupDesc;

2511 }

2512 else

2513 {

2514

2515

2516

2517

2518

2519

2521

2524 type_id != tupDesc->tdtypeid ||

2525 typmod != tupDesc->tdtypmod))

2526 {

2528

2532 if (changed)

2533 *changed = true;

2534 }

2535 return tupDesc;

2536 }

2537}

2538

2539

2540

2541

2542

2543

2544

2547{

2549 int attnum = op->d.var.attnum + 1;

2550

2552

2553

2554

2555

2556

2557

2559}

2560

2561

2564{

2566}

2567

2568

2571{

2573}

2574

2575

2578{

2580}

2581

2582

2585{

2587 int attnum = op->d.assign_var.attnum + 1;

2588 int resultnum = op->d.assign_var.resultnum;

2590

2592

2593

2594

2595

2596

2597

2598

2599

2600

2601

2602 Assert(resultnum >= 0 && resultnum < outslot->tts_tupleDescriptor->natts);

2605 return 0;

2606}

2607

2608

2611{

2613}

2614

2615

2618{

2620}

2621

2622

2625{

2627}

2628

2629

2632{

2638

2639

2640

2641

2642

2643 *op->resvalue = *op->d.casetest.value;

2644 *op->resnull = *op->d.casetest.isnull;

2645

2646 op++;

2647

2648 nargs = op->d.func.nargs;

2649 fcinfo = op->d.func.fcinfo_data;

2651

2652

2653 for (int argno = 0; argno < nargs; argno++)

2654 {

2656 {

2658 return (Datum) 0;

2659 }

2660 }

2661 fcinfo->isnull = false;

2662 d = op->d.func.fn_addr(fcinfo);

2664 return d;

2665}

2666

2667

2670{

2672

2673 *isnull = op->d.constval.isnull;

2674 return op->d.constval.value;

2675}

2676

2677

2680{

2682 int attnum = op->d.var.attnum;

2683

2684

2685

2686

2687

2688

2689

2692 Assert(attnum >= 0 && attnum < slot->tts_nvalid);

2693

2695

2697}

2698

2699

2702{

2704}

2705

2706

2709{

2711}

2712

2713

2716{

2718}

2719

2720

2723{

2725 int attnum = op->d.assign_var.attnum;

2726 int resultnum = op->d.assign_var.resultnum;

2728

2729

2730

2733 Assert(attnum >= 0 && attnum < inslot->tts_nvalid);

2734 Assert(resultnum >= 0 && resultnum < outslot->tts_tupleDescriptor->natts);

2735

2738

2739 return 0;

2740}

2741

2742

2745{

2747}

2748

2749

2752{

2754}

2755

2756

2759{

2761}

2762

2763

2764

2765

2769{

2777

2780

2783

2786

2788 {

2790

2792 hashkey = hashkey ^ hashvalue;

2793 }

2794

2797}

2798

2799

2802{

2808

2811

2814

2816

2819 else

2820 return (Datum) 0;

2821}

2822

2823

2826{

2828}

2829

2830

2833{

2835}

2836

2837

2840{

2845

2848

2850

2853 else

2854 return (Datum) 0;

2855}

2856

2857

2861{

2863}

2864

2865

2869{

2871}

2872

2873

2874

2875

2879{

2885

2888

2891

2893 {

2896 }

2897 else

2898 {

2899

2901 return (Datum) 0;

2902 }

2903}

2904

2905#if defined(EEO_USE_COMPUTED_GOTO)

2906

2907

2908

2909

2910static int

2911dispatch_compare_ptr(const void *a, const void *b)

2912{

2913 const ExprEvalOpLookup *la = (const ExprEvalOpLookup *) a;

2914 const ExprEvalOpLookup *lb = (const ExprEvalOpLookup *) b;

2915

2916 if (la->opcode < lb->opcode)

2917 return -1;

2918 else if (la->opcode > lb->opcode)

2919 return 1;

2920 return 0;

2921}

2922#endif

2923

2924

2925

2926

2927static void

2929{

2930#if defined(EEO_USE_COMPUTED_GOTO)

2931

2932 if (dispatch_table == NULL)

2933 {

2934 dispatch_table = (const void **)

2936

2937

2939 {

2940 reverse_dispatch_table[i].opcode = dispatch_table[i];

2941 reverse_dispatch_table[i].op = (ExprEvalOp) i;

2942 }

2943

2944

2945 qsort(reverse_dispatch_table,

2947 sizeof(ExprEvalOpLookup),

2948 dispatch_compare_ptr);

2949 }

2950#endif

2951}

2952

2953

2954

2955

2956

2957

2958

2961{

2962#if defined(EEO_USE_COMPUTED_GOTO)

2964 {

2965 ExprEvalOpLookup key;

2966 ExprEvalOpLookup *res;

2967

2968 key.opcode = (void *) op->opcode;

2969 res = bsearch(&key,

2970 reverse_dispatch_table,

2972 sizeof(ExprEvalOpLookup),

2973 dispatch_compare_ptr);

2974 Assert(res);

2975 return res->op;

2976 }

2977#endif

2979}

2980

2981

2982

2983

2984

2985

2986

2987

2988

2989void

2992{

2996

2998

2999 fcinfo->isnull = false;

3000 d = op->d.func.fn_addr(fcinfo);

3001 *op->resvalue = d;

3002 *op->resnull = fcinfo->isnull;

3003

3005}

3006

3007

3008

3009

3010void

3013{

3014

3018 int nargs = op->d.func.nargs;

3020

3021

3022 for (int argno = 0; argno < nargs; argno++)

3023 {

3025 {

3026 *op->resnull = true;

3027 return;

3028 }

3029 }

3030

3032

3033 fcinfo->isnull = false;

3034 d = op->d.func.fn_addr(fcinfo);

3035 *op->resvalue = d;

3036 *op->resnull = fcinfo->isnull;

3037

3039}

3040

3041

3042

3043

3044

3045

3046

3047void

3049{

3051

3054 {

3055

3057

3059 }

3060 *op->resvalue = prm->value;

3062}

3063

3064

3065

3066

3067

3068

3069void

3071{

3073 int paramId = op->d.param.paramid;

3074

3075 if (likely(paramInfo &&

3076 paramId > 0 && paramId <= paramInfo->numParams))

3077 {

3080

3081

3083 prm = paramInfo->paramFetch(paramInfo, paramId, false, &prmdata);

3084 else

3085 prm = &paramInfo->params[paramId - 1];

3086

3088 {

3089

3092 (errcode(ERRCODE_DATATYPE_MISMATCH),

3093 errmsg("type of parameter %d (%s) does not match that when preparing the plan (%s)",

3094 paramId,

3097 *op->resvalue = prm->value;

3099 return;

3100 }

3101 }

3102

3104 (errcode(ERRCODE_UNDEFINED_OBJECT),

3105 errmsg("no value found for parameter %d", paramId)));

3106}

3107

3108

3109

3110

3111

3112void

3114{

3116

3118

3119

3121

3124}

3125

3126

3127

3128

3129

3130

3131

3132

3133

3134void

3136{

3137 char *str;

3138

3139

3140 if (*op->resnull)

3141 {

3142

3143 str = NULL;

3144 }

3145 else

3146 {

3148

3149 fcinfo_out = op->d.iocoerce.fcinfo_data_out;

3150 fcinfo_out->args[0].value = *op->resvalue;

3152

3153 fcinfo_out->isnull = false;

3155

3156

3158 }

3159

3160

3161 if (op->d.iocoerce.finfo_in->fn_strict || str != NULL)

3162 {

3164

3165 fcinfo_in = op->d.iocoerce.fcinfo_data_in;

3168

3169

3170

3172

3173 fcinfo_in->isnull = false;

3175

3177 {

3178 *op->resnull = true;

3179 *op->resvalue = (Datum) 0;

3180 return;

3181 }

3182

3183

3184 if (str == NULL)

3186 else

3188 }

3189}

3190

3191

3192

3193

3194void

3196{

3199

3200 *op->resnull = false;

3201

3202

3203

3204

3205

3206 switch (svf->op)

3207 {

3210 break;

3214 break;

3218 break;

3222 break;

3226 break;

3232 *op->resnull = fcinfo->isnull;

3233 break;

3237 *op->resnull = fcinfo->isnull;

3238 break;

3242 *op->resnull = fcinfo->isnull;

3243 break;

3247 *op->resnull = fcinfo->isnull;

3248 break;

3249 }

3250}

3251

3252

3253

3254

3255

3256

3257

3258

3259

3260

3261void

3263{

3265 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),

3266 errmsg("WHERE CURRENT OF is not supported for this table type")));

3267}

3268

3269

3270

3271

3272void

3274{

3276

3277 switch (op->d.nextvalueexpr.seqtypid)

3278 {

3279 case INT2OID:

3281 break;

3282 case INT4OID:

3284 break;

3285 case INT8OID:

3287 break;

3288 default:

3289 elog(ERROR, "unsupported sequence type %u",

3290 op->d.nextvalueexpr.seqtypid);

3291 }

3292 *op->resnull = false;

3293}

3294

3295

3296

3297

3298void

3300{

3302}

3303

3304

3305

3306

3307void

3309{

3311}

3312

3313

3314static void

3316 ExprContext *econtext, bool checkisnull)

3317{

3321 Oid tupType;

3322 int32 tupTypmod;

3325

3326 *op->resnull = false;

3327

3328

3330 {

3332 return;

3333 }

3334

3335

3336

3337

3338

3339

3340

3341

3342

3343

3344

3345

3346

3347

3348

3349

3350

3352

3355

3356

3358 &op->d.nulltest_row.rowcache, NULL);

3359

3360

3361

3362

3364 tmptup.t_data = tuple;

3365

3366 for (int att = 1; att <= tupDesc->natts; att++)

3367 {

3368

3370 continue;

3372 {

3373

3374 if (!checkisnull)

3375 {

3377 return;

3378 }

3379 }

3380 else

3381 {

3382

3383 if (checkisnull)

3384 {

3386 return;

3387 }

3388 }

3389 }

3390

3392}

3393

3394

3395

3396

3397

3398

3399

3400void

3402{

3405 int nelems = op->d.arrayexpr.nelems;

3406 int ndims = 0;

3409

3410

3411 *op->resnull = false;

3412

3413 if (op->d.arrayexpr.multidims)

3414 {

3415

3416 Datum *dvalues = op->d.arrayexpr.elemvalues;

3417 bool *dnulls = op->d.arrayexpr.elemnulls;

3418

3419

3420 ndims = 1;

3422 lbs[0] = 1;

3423

3426 op->d.arrayexpr.elemlength,

3427 op->d.arrayexpr.elembyval,

3428 op->d.arrayexpr.elemalign);

3429 }

3430 else

3431 {

3432

3433 int nbytes = 0;

3435 int outer_nelems = 0;

3436 int elem_ndims = 0;

3437 int *elem_dims = NULL;

3438 int *elem_lbs = NULL;

3439 bool firstone = true;

3440 bool havenulls = false;

3441 bool haveempty = false;

3442 char **subdata;

3443 bits8 **subbitmaps;

3444 int *subbytes;

3445 int *subnitems;

3446 int32 dataoffset;

3447 char *dat;

3448 int iitem;

3449

3450 subdata = (char **) palloc(nelems * sizeof(char *));

3452 subbytes = (int *) palloc(nelems * sizeof(int));

3453 subnitems = (int *) palloc(nelems * sizeof(int));

3454

3455

3456 for (int elemoff = 0; elemoff < nelems; elemoff++)

3457 {

3458 Datum arraydatum;

3459 bool eisnull;

3461 int this_ndims;

3462

3463 arraydatum = op->d.arrayexpr.elemvalues[elemoff];

3464 eisnull = op->d.arrayexpr.elemnulls[elemoff];

3465

3466

3467 if (eisnull)

3468 {

3469 haveempty = true;

3470 continue;

3471 }

3472

3474

3475

3478 (errcode(ERRCODE_DATATYPE_MISMATCH),

3479 errmsg("cannot merge incompatible arrays"),

3480 errdetail("Array with element type %s cannot be "

3481 "included in ARRAY construct with element type %s.",

3484

3485 this_ndims = ARR_NDIM(array);

3486

3487 if (this_ndims <= 0)

3488 {

3489 haveempty = true;

3490 continue;

3491 }

3492

3493 if (firstone)

3494 {

3495

3496 elem_ndims = this_ndims;

3497 ndims = elem_ndims + 1;

3498 if (ndims <= 0 || ndims > MAXDIM)

3500 (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),

3501 errmsg("number of array dimensions (%d) exceeds the maximum allowed (%d)",

3503

3504 elem_dims = (int *) palloc(elem_ndims * sizeof(int));

3505 memcpy(elem_dims, ARR_DIMS(array), elem_ndims * sizeof(int));

3506 elem_lbs = (int *) palloc(elem_ndims * sizeof(int));

3507 memcpy(elem_lbs, ARR_LBOUND(array), elem_ndims * sizeof(int));

3508

3509 firstone = false;

3510 }

3511 else

3512 {

3513

3514 if (elem_ndims != this_ndims ||

3515 memcmp(elem_dims, ARR_DIMS(array),

3516 elem_ndims * sizeof(int)) != 0 ||

3518 elem_ndims * sizeof(int)) != 0)

3520 (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),

3521 errmsg("multidimensional arrays must have array "

3522 "expressions with matching dimensions")));

3523 }

3524

3525 subdata[outer_nelems] = ARR_DATA_PTR(array);

3528 nbytes += subbytes[outer_nelems];

3529

3532 (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),

3533 errmsg("array size exceeds the maximum allowed (%d)",

3535 subnitems[outer_nelems] = ArrayGetNItems(this_ndims,

3538 outer_nelems++;

3539 }

3540

3541

3542

3543

3544

3545

3546

3547 if (haveempty)

3548 {

3549 if (ndims == 0)

3550 {

3552 return;

3553 }

3555 (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),

3556 errmsg("multidimensional arrays must have array "

3557 "expressions with matching dimensions")));

3558 }

3559

3560

3561 dims[0] = outer_nelems;

3562 lbs[0] = 1;

3563 for (int i = 1; i < ndims; i++)

3564 {

3565 dims[i] = elem_dims[i - 1];

3566 lbs[i] = elem_lbs[i - 1];

3567 }

3568

3569

3572

3573 if (havenulls)

3574 {

3576 nbytes += dataoffset;

3577 }

3578 else

3579 {

3580 dataoffset = 0;

3582 }

3583

3586 result->ndim = ndims;

3589 memcpy(ARR_DIMS(result), dims, ndims * sizeof(int));

3590 memcpy(ARR_LBOUND(result), lbs, ndims * sizeof(int));

3591

3593 iitem = 0;

3594 for (int i = 0; i < outer_nelems; i++)

3595 {

3596 memcpy(dat, subdata[i], subbytes[i]);

3597 dat += subbytes[i];

3598 if (havenulls)

3600 subbitmaps[i], 0,

3601 subnitems[i]);

3602 iitem += subnitems[i];

3603 }

3604 }

3605

3607}

3608

3609

3610

3611

3612

3613

3614void

3616{

3617 Datum arraydatum;

3618

3619

3620 if (*op->resnull)

3621 return;

3622

3623 arraydatum = *op->resvalue;

3624

3625

3626

3627

3628

3629 if (op->d.arraycoerce.elemexprstate == NULL)

3630 {

3631

3633

3634 ARR_ELEMTYPE(array) = op->d.arraycoerce.resultelemtype;

3636 return;

3637 }

3638

3639

3640

3641

3643 op->d.arraycoerce.elemexprstate,

3644 econtext,

3645 op->d.arraycoerce.resultelemtype,

3646 op->d.arraycoerce.amstate);

3647}

3648

3649

3650

3651

3652

3653

3654

3655void

3657{

3659

3660

3662 op->d.row.elemvalues,

3663 op->d.row.elemnulls);

3664

3666 *op->resnull = false;

3667}

3668

3669

3670

3671

3672

3673

3674

3675void

3677{

3679 bool *nulls = op->d.minmax.nulls;

3681 MinMaxOp operator = op->d.minmax.op;

3682

3683

3686

3687

3688 *op->resnull = true;

3689

3690 for (int off = 0; off < op->d.minmax.nelems; off++)

3691 {

3692

3694 continue;

3695

3696 if (*op->resnull)

3697 {

3698

3699 *op->resvalue = values[off];

3700 *op->resnull = false;

3701 }

3702 else

3703 {

3704 int cmpresult;

3705

3706

3709

3710 fcinfo->isnull = false;

3712 if (fcinfo->isnull)

3713 continue;

3714

3715 if (cmpresult > 0 && operator == IS_LEAST)

3716 *op->resvalue = values[off];

3717 else if (cmpresult < 0 && operator == IS_GREATEST)

3718 *op->resvalue = values[off];

3719 }

3720 }

3721}

3722

3723

3724

3725

3726

3727

3728void

3730{

3734 Oid tupType;

3735 int32 tupTypmod;

3739

3740

3741 if (*op->resnull)

3742 return;

3743

3744 tupDatum = *op->resvalue;

3745

3746

3748 {

3750

3752

3753

3755

3756

3757

3758

3759

3760

3761 if (fieldnum <= 0)

3762 elog(ERROR, "unsupported reference to system column %d in FieldSelect",

3764 if (fieldnum > tupDesc->natts)

3765 elog(ERROR, "attribute number %d exceeds number of columns %d",

3768

3769

3770 if (attr->attisdropped)

3771 {

3772 *op->resnull = true;

3773 return;

3774 }

3775

3776

3777

3778 if (op->d.fieldselect.resulttype != attr->atttypid)

3780 (errcode(ERRCODE_DATATYPE_MISMATCH),

3782 errdetail("Table has type %s, but query expects %s.",

3785

3786

3788 op->resnull);

3789 }

3790 else

3791 {

3792

3794

3797

3798

3800 &op->d.fieldselect.rowcache, NULL);

3801

3802

3803

3804

3805

3806

3807 if (fieldnum <= 0)

3808 elog(ERROR, "unsupported reference to system column %d in FieldSelect",

3810 if (fieldnum > tupDesc->natts)

3811 elog(ERROR, "attribute number %d exceeds number of columns %d",

3814

3815

3816 if (attr->attisdropped)

3817 {

3818 *op->resnull = true;

3819 return;

3820 }

3821

3822

3823

3824 if (op->d.fieldselect.resulttype != attr->atttypid)

3826 (errcode(ERRCODE_DATATYPE_MISMATCH),

3828 errdetail("Table has type %s, but query expects %s.",

3831

3832

3834 tmptup.t_data = tuple;

3835

3836

3839 tupDesc,

3840 op->resnull);

3841 }

3842}

3843

3844

3845

3846

3847

3848

3849

3850

3851

3852

3853void

3855{

3856 if (*op->resnull)

3857 {

3858

3859 memset(op->d.fieldstore.nulls, true,

3860 op->d.fieldstore.ncolumns * sizeof(bool));

3861 }

3862 else

3863 {

3864

3865

3866

3867

3868 Datum tupDatum = *op->resvalue;

3872

3877 tmptup.t_data = tuphdr;

3878

3879

3880

3881

3882

3883

3884

3886 op->d.fieldstore.rowcache, NULL);

3887

3888

3889 if (unlikely(tupDesc->natts > op->d.fieldstore.ncolumns))

3890 elog(ERROR, "too many columns in composite type %u",

3891 op->d.fieldstore.fstore->resulttype);

3892

3894 op->d.fieldstore.values,

3895 op->d.fieldstore.nulls);

3896 }

3897}

3898

3899

3900

3901

3902

3903void

3905{

3908

3909

3911 op->d.fieldstore.rowcache, NULL);

3912

3914 op->d.fieldstore.values,

3915 op->d.fieldstore.nulls);

3916

3918 *op->resnull = false;

3919}

3920

3921

3922

3923

3924

3925

3926

3927void

3929{

3935 outdesc;

3936 bool changed = false;

3937

3938

3939 if (*op->resnull)

3940 return;

3941

3942 tupDatum = *op->resvalue;

3944

3945

3946

3947

3948

3949

3951 op->d.convert_rowtype.incache,

3952 &changed);

3955 op->d.convert_rowtype.outcache,

3956 &changed);

3958

3959

3960

3961

3962

3963

3964

3967

3968

3969 if (changed)

3970 {

3972

3973

3975

3976

3978

3980 }

3981

3982

3984 tmptup.t_data = tuple;

3985

3986 if (op->d.convert_rowtype.map != NULL)

3987 {

3988

3990

3992 }

3993 else

3994 {

3995

3996

3997

3998

3999

4000

4001

4002

4003

4004

4006 }

4007

4010}

4011

4012

4013

4014

4015

4016

4017

4018

4019

4020

4021

4022void

4024{

4026 bool useOr = op->d.scalararrayop.useOr;

4027 bool strictfunc = op->d.scalararrayop.finfo->fn_strict;

4031 bool resultnull;

4035 char *s;

4037 int bitmask;

4038

4039

4040

4041

4042

4043 if (*op->resnull)

4044 return;

4045

4046

4048

4049

4050

4051

4052

4053

4054

4057 {

4059 *op->resnull = false;

4060 return;

4061 }

4062

4063

4064

4065

4066

4067 if (fcinfo->args[0].isnull && strictfunc)

4068 {

4069 *op->resnull = true;

4070 return;

4071 }

4072

4073

4074

4075

4076

4077 if (op->d.scalararrayop.element_type != ARR_ELEMTYPE(arr))

4078 {

4080 &op->d.scalararrayop.typlen,

4081 &op->d.scalararrayop.typbyval,

4082 &op->d.scalararrayop.typalign);

4083 op->d.scalararrayop.element_type = ARR_ELEMTYPE(arr);

4084 }

4085

4086 typlen = op->d.scalararrayop.typlen;

4087 typbyval = op->d.scalararrayop.typbyval;

4088 typalign = op->d.scalararrayop.typalign;

4089

4090

4092 resultnull = false;

4093

4094

4097 bitmask = 1;

4098

4099 for (int i = 0; i < nitems; i++)

4100 {

4102 Datum thisresult;

4103

4104

4105 if (bitmap && (*bitmap & bitmask) == 0)

4106 {

4109 }

4110 else

4111 {

4117 }

4118

4119

4120 if (fcinfo->args[1].isnull && strictfunc)

4121 {

4122 fcinfo->isnull = true;

4123 thisresult = (Datum) 0;

4124 }

4125 else

4126 {

4127 fcinfo->isnull = false;

4128 thisresult = op->d.scalararrayop.fn_addr(fcinfo);

4129 }

4130

4131

4133 resultnull = true;

4135 {

4137 {

4139 resultnull = false;

4140 break;

4141 }

4142 }

4143 else

4144 {

4146 {

4148 resultnull = false;

4149 break;

4150 }

4151 }

4152

4153

4154 if (bitmap)

4155 {

4156 bitmask <<= 1;

4157 if (bitmask == 0x100)

4158 {

4159 bitmap++;

4160 bitmask = 1;

4161 }

4162 }

4163 }

4164

4165 *op->resvalue = result;

4166 *op->resnull = resultnull;

4167}

4168

4169

4170

4171

4172

4173

4174

4177{

4181

4182 fcinfo->args[0].value = key;

4183 fcinfo->args[0].isnull = false;

4184

4186

4188}

4189

4190

4191

4192

4193

4194static bool

4196{

4198

4201

4203 fcinfo->args[0].isnull = false;

4204 fcinfo->args[1].value = key2;

4205 fcinfo->args[1].isnull = false;

4206

4208

4210}

4211

4212

4213

4214

4215

4216

4217

4218

4219

4220

4221

4222

4223

4224

4225void

4227{

4230 bool inclause = op->d.hashedscalararrayop.inclause;

4231 bool strictfunc = op->d.hashedscalararrayop.finfo->fn_strict;

4233 bool scalar_isnull = fcinfo->args[0].isnull;

4235 bool resultnull;

4236 bool hashfound;

4237

4238

4240

4241

4242

4243

4244

4245 if (fcinfo->args[0].isnull && strictfunc)

4246 {

4247 *op->resnull = true;

4248 return;

4249 }

4250

4251

4253 {

4260 char *s;

4262 int bitmask;

4265

4266 saop = op->d.hashedscalararrayop.saop;

4267

4270

4275

4277

4281 op->d.hashedscalararrayop.elements_tab = elements_tab;

4283

4286

4289 1,

4290 saop->inputcollid,

4291 NULL,

4292 NULL);

4293

4294

4295

4296

4297

4298

4299

4302

4304

4307 bitmask = 1;

4308 for (int i = 0; i < nitems; i++)

4309 {

4310

4311 if (bitmap && (*bitmap & bitmask) == 0)

4312 {

4314 }

4315 else

4316 {

4318

4322

4324 }

4325

4326

4327 if (bitmap)

4328 {

4329 bitmask <<= 1;

4330 if (bitmask == 0x100)

4331 {

4332 bitmap++;

4333 bitmask = 1;

4334 }

4335 }

4336 }

4337

4338

4339

4340

4341

4342 op->d.hashedscalararrayop.has_nulls = has_nulls;

4343 }

4344

4345

4347

4348

4351 else

4352 result = BoolGetDatum(!hashfound);

4353

4354 resultnull = false;

4355

4356

4357

4358

4359

4360

4361

4362 if (!hashfound && op->d.hashedscalararrayop.has_nulls)

4363 {

4364 if (strictfunc)

4365 {

4366

4367

4368

4369

4370

4371 result = (Datum) 0;

4372 resultnull = true;

4373 }

4374 else

4375 {

4376

4377

4378

4379

4380

4381

4382

4384 fcinfo->args[0].isnull = scalar_isnull;

4387

4388 result = op->d.hashedscalararrayop.finfo->fn_addr(fcinfo);

4389 resultnull = fcinfo->isnull;

4390

4391

4392

4393

4394

4396 result = !result;

4397 }

4398 }

4399

4400 *op->resvalue = result;

4401 *op->resnull = resultnull;

4402}

4403

4404

4405

4406

4407void

4409{

4410 if (*op->resnull)

4412 (errcode(ERRCODE_NOT_NULL_VIOLATION),

4413 errmsg("domain %s does not allow null values",

4416}

4417

4418

4419

4420

4421void

4423{

4424 if (!*op->d.domaincheck.checknull &&

4427 (errcode(ERRCODE_CHECK_VIOLATION),

4428 errmsg("value for domain %s violates check constraint \"%s\"",

4430 op->d.domaincheck.constraintname),

4432 op->d.domaincheck.constraintname)));

4433}

4434

4435

4436

4437

4438

4439

4440

4441void

4443{

4446

4447 *op->resnull = true;

4448 *op->resvalue = (Datum) 0;

4449

4451 {

4453 {

4455 bool *argnull = op->d.xmlexpr.argnull;

4457

4459 {

4462 }

4463

4465 {

4467 *op->resnull = false;

4468 }

4469 }

4470 break;

4471

4473 {

4475 bool *argnull = op->d.xmlexpr.named_argnull;

4479 int i;

4480

4482

4483 i = 0;

4485 {

4488

4490 {

4493 argname,

4496 argname);

4497 *op->resnull = false;

4498 }

4499 i++;

4500 }

4501

4502 if (!*op->resnull)

4503 {

4504 text *result;

4505

4508 }

4509

4511 }

4512 break;

4513

4516 op->d.xmlexpr.named_argvalue,

4517 op->d.xmlexpr.named_argnull,

4518 op->d.xmlexpr.argvalue,

4519 op->d.xmlexpr.argnull));

4520 *op->resnull = false;

4521 break;

4522

4524 {

4526 bool *argnull = op->d.xmlexpr.argnull;

4528 bool preserve_whitespace;

4529

4530

4532

4534 return;

4537

4538 if (argnull[1])

4539 return;

4542

4544 xexpr->xmloption,

4545 preserve_whitespace));

4546 *op->resnull = false;

4547 }

4548 break;

4549

4551 {

4554

4555

4557

4559 {

4560 isnull = op->d.xmlexpr.argnull[0];

4562 arg = NULL;

4563 else

4565 }

4566 else

4567 {

4568 arg = NULL;

4570 }

4571

4575 op->resnull));

4576 }

4577 break;

4578

4580 {

4582 bool *argnull = op->d.xmlexpr.argnull;

4584 text *version;

4585 int standalone;

4586

4587

4589

4591 return;

4593

4595 version = NULL;

4596 else

4598

4601

4603 version,

4604 standalone));

4605 *op->resnull = false;

4606 }

4607 break;

4608

4610 {

4612 bool *argnull = op->d.xmlexpr.argnull;

4613

4614

4616

4618 return;

4620

4621 *op->resvalue =

4623 xexpr->xmloption,

4625 *op->resnull = false;

4626 }

4627 break;

4628

4630 {

4632 bool *argnull = op->d.xmlexpr.argnull;

4633

4634

4636

4638 return;

4640

4641 *op->resvalue =

4643 *op->resnull = false;

4644 }

4645 break;

4646

4647 default:

4648 elog(ERROR, "unrecognized XML operation");

4649 break;

4650 }

4651}

4652

4653

4654

4655

4656void

4659{

4664 bool isnull = false;

4665

4667 res = (is_jsonb ?

4675 res = (is_jsonb ?

4684 {

4686 {

4687 res = (Datum) 0;

4689 }

4690 else

4691 {

4696

4697 if (is_jsonb)

4699 else

4701 }

4702 }

4704 {

4706 {

4707 res = (Datum) 0;

4709 }

4710 else

4711 {

4714

4715 if (is_jsonb)

4717 else

4718 {

4721 }

4722 }

4723 }

4724 else

4725 elog(ERROR, "invalid JsonConstructorExpr type %d", ctor->type);

4726

4727 *op->resvalue = res;

4729}

4730

4731

4732

4733

4734void

4736{

4738 Datum js = *op->resvalue;

4739 Oid exprtype;

4740 bool res;

4741

4742 if (*op->resnull)

4743 {

4745 return;

4746 }

4747

4749

4750 if (exprtype == TEXTOID || exprtype == JSONOID)

4751 {

4753

4755 res = true;

4756 else

4757 {

4759 {

4762 break;

4765 break;

4772 break;

4773 default:

4774 res = false;

4775 break;

4776 }

4777 }

4778

4779

4780

4781

4782

4785 }

4786 else if (exprtype == JSONBOID)

4787 {

4789 res = true;

4790 else

4791 {

4793

4795 {

4798 break;

4801 break;

4804 break;

4805 default:

4806 res = false;

4807 break;

4808 }

4809 }

4810

4811

4812 }

4813 else

4814 res = false;

4815

4817}

4818

4819

4820

4821

4822

4823

4824

4825

4826

4827

4828

4829

4830

4831

4832

4833

4834int

4837{

4843 bool error = false,

4844 empty = false;

4847

4850

4851

4854

4855

4857 {

4860 }

4862

4863 switch (jsexpr->op)

4864 {

4866 {

4868 !throw_error ? &error : NULL,

4870

4872 {

4873 *op->resnull = false;

4875 }

4876 }

4877 break;

4878

4881 !throw_error ? &error : NULL,

4884

4886 break;

4887

4889 {

4891 !throw_error ? &error : NULL,

4894

4895 if (jbv == NULL)

4896 {

4897

4898 *op->resvalue = (Datum) 0;

4899 *op->resnull = true;

4900 }

4901 else if (error && !empty)

4902 {

4905 {

4908 }

4910 {

4912 *op->resnull = false;

4913 }

4914 else

4915 {

4917

4918

4919

4920

4921

4925 }

4926 }

4927 break;

4928 }

4929

4930

4931

4932 default:

4933 elog(ERROR, "unrecognized SQL/JSON expression op %d",

4934 (int) jsexpr->op);

4935 return false;

4936 }

4937

4938

4939

4940

4941

4943 {

4945

4946 Assert(jump_eval_coercion == -1);

4948 Assert(fcinfo != NULL);

4952

4953

4954

4955

4956

4957

4958 fcinfo->isnull = false;

4962 }

4963

4964

4965

4966

4967

4968

4969

4970

4971

4972

4973 if (empty)

4974 {

4975 *op->resvalue = (Datum) 0;

4976 *op->resnull = true;

4978 {

4980 {

4982

4985

4987 }

4988 }

4990 {

4992

4995 Assert(!throw_error);

4996

4998 }

4999

5002 errcode(ERRCODE_NO_SQL_JSON_ITEM),

5003 errmsg("no SQL/JSON item found for specified path of column \"%s\"",

5005 else

5007 errcode(ERRCODE_NO_SQL_JSON_ITEM),

5008 errmsg("no SQL/JSON item found for specified path"));

5009 }

5010

5011

5012

5013

5014

5016 {

5017 Assert(!throw_error);

5018 *op->resvalue = (Datum) 0;

5019 *op->resnull = true;

5021

5024

5026 }

5027

5028 return jump_eval_coercion >= 0 ? jump_eval_coercion : jsestate->jump_end;

5029}

5030

5031

5032

5033

5034

5035

5036static char *

5038{

5040

5041

5042 switch (item->type)

5043 {

5046 return NULL;

5047

5049 {

5050 char *str = palloc(item->val.string.len + 1);

5051

5052 memcpy(str, item->val.string.val, item->val.string.len);

5053 str[item->val.string.len] = '\0';

5054 return str;

5055 }

5056

5060

5064

5066 switch (item->val.datetime.typid)

5067 {

5068 case DATEOID:

5070 item->val.datetime.value));

5071 case TIMEOID:

5073 item->val.datetime.value));

5074 case TIMETZOID:

5076 item->val.datetime.value));

5077 case TIMESTAMPOID:

5079 item->val.datetime.value));

5080 case TIMESTAMPTZOID:

5082 item->val.datetime.value));

5083 default:

5084 elog(ERROR, "unexpected jsonb datetime type oid %u",

5085 item->val.datetime.typid);

5086 }

5087 break;

5088

5094

5095 default:

5096 elog(ERROR, "unexpected jsonb value type %d", item->type);

5097 }

5098

5101 return NULL;

5102}

5103

5104

5105

5106

5107

5108

5109

5110

5111void

5114{

5116

5117

5118

5119

5120

5121

5122

5123

5124

5125

5126

5127 if (op->d.jsonexpr_coercion.exists_coerce)

5128 {

5129 if (op->d.jsonexpr_coercion.exists_cast_to_int)

5130 {

5131

5132 if (op->d.jsonexpr_coercion.exists_check_domain &&

5134 op->d.jsonexpr_coercion.targettype,

5135 &op->d.jsonexpr_coercion.json_coercion_cache,

5138 {

5139 *op->resnull = true;

5140 *op->resvalue = (Datum) 0;

5141 }

5142 else

5144 return;

5145 }

5146

5151 }

5152

5154 op->d.jsonexpr_coercion.targettype,

5155 op->d.jsonexpr_coercion.targettypmod,

5156 &op->d.jsonexpr_coercion.json_coercion_cache,

5158 op->resnull,

5159 op->d.jsonexpr_coercion.omit_quotes,

5161}

5162

5163static char *

5165{

5166

5167

5168

5169

5170 const char *behavior_names[] =

5171 {

5172 "NULL",

5173 "ERROR",

5174 "EMPTY",

5175 "TRUE",

5176 "FALSE",

5177 "UNKNOWN",

5178 "EMPTY ARRAY",

5179 "EMPTY OBJECT",

5180 "DEFAULT"

5181 };

5182

5183 return pstrdup(behavior_names[behavior->btype]);

5184}

5185

5186

5187

5188

5189

5190

5191void

5193{

5195

5197 {

5198

5199

5200

5201

5202

5203

5206 (errcode(ERRCODE_DATATYPE_MISMATCH),

5207

5208 errmsg("could not coerce %s expression (%s) to the RETURNING type",

5209 "ON ERROR",

5214 (errcode(ERRCODE_DATATYPE_MISMATCH),

5215

5216 errmsg("could not coerce %s expression (%s) to the RETURNING type",

5217 "ON EMPTY",

5220

5221 *op->resvalue = (Datum) 0;

5222 *op->resnull = true;

5223

5225

5226

5227

5228

5229

5233 }

5234}

5235

5236

5237

5238

5239

5240

5241

5242

5243

5244

5245void

5247{

5249 int result = 0;

5252

5253 foreach(lc, op->d.grouping_func.clauses)

5254 {

5256

5257 result <<= 1;

5258

5260 result |= 1;

5261 }

5262

5264 *op->resnull = false;

5265}

5266

5267

5268

5269

5270

5271

5272void

5275{

5278

5279 if (!relaction)

5280 elog(ERROR, "no merge action in progress");

5281

5282

5284 {

5287 *op->resnull = false;

5288 break;

5291 *op->resnull = false;

5292 break;

5295 *op->resnull = false;

5296 break;

5298 elog(ERROR, "unexpected merge action: DO NOTHING");

5299 break;

5300 default:

5301 elog(ERROR, "unrecognized commandType: %d",

5303 }

5304}

5305

5306

5307

5308

5309void

5311{

5313

5314

5316

5318}

5319

5320

5321

5322

5323

5324

5325

5326void

5328{

5335

5336

5338

5339

5341 {

5343

5345 break;

5346

5348

5350 break;

5351

5352

5353

5354 default:

5355

5356

5357

5358

5359

5360

5361

5362

5363 switch (variable->varreturningtype)

5364 {

5367 break;

5368

5371 {

5372 *op->resvalue = (Datum) 0;

5373 *op->resnull = true;

5374 return;

5375 }

5377 break;

5378

5381 {

5382 *op->resvalue = (Datum) 0;

5383 *op->resnull = true;

5384 return;

5385 }

5387 break;

5388 }

5389 break;

5390 }

5391

5392

5393 if (op->d.wholerow.junkFilter != NULL)

5395

5396

5397

5398

5399

5400

5401

5402

5403 if (op->d.wholerow.first)

5404 {

5405

5406 op->d.wholerow.slow = false;

5407

5408

5409

5410

5411

5412 if (variable->vartype != RECORDOID)

5413 {

5416

5417

5418

5419

5420

5421

5422

5423

5424

5425

5426

5427

5428

5429

5430

5431

5433 -1, false);

5434

5436

5437 if (var_tupdesc->natts != slot_tupdesc->natts)

5439 (errcode(ERRCODE_DATATYPE_MISMATCH),

5440 errmsg("table row type and query-specified row type do not match"),

5441 errdetail_plural("Table row contains %d attribute, but query expects %d.",

5442 "Table row contains %d attributes, but query expects %d.",

5443 slot_tupdesc->natts,

5444 slot_tupdesc->natts,

5445 var_tupdesc->natts)));

5446

5447 for (int i = 0; i < var_tupdesc->natts; i++)

5448 {

5451

5452 if (vattr->atttypid == sattr->atttypid)

5453 continue;

5454 if (!vattr->attisdropped)

5456 (errcode(ERRCODE_DATATYPE_MISMATCH),

5457 errmsg("table row type and query-specified row type do not match"),

5458 errdetail("Table has type %s at ordinal position %d, but query expects %s.",

5460 i + 1,

5462

5463 if (vattr->attlen != sattr->attlen ||

5464 vattr->attalign != sattr->attalign)

5465 op->d.wholerow.slow = true;

5466 }

5467

5468

5469

5470

5471

5472

5476

5478 }

5479 else

5480 {

5481

5482

5483

5484

5485

5489

5490

5491

5492

5493

5494

5495 output_tupdesc->tdtypeid = RECORDOID;

5496 output_tupdesc->tdtypmod = -1;

5497

5498

5499

5500

5501

5502

5503

5504

5505

5506

5507

5508

5509

5510

5511

5514 {

5517

5518 if (rte->eref)

5520 }

5521 }

5522

5523

5525

5526 op->d.wholerow.first = false;

5527 }

5528

5529

5530

5531

5532

5534

5535 if (op->d.wholerow.slow)

5536 {

5537

5539 TupleDesc var_tupdesc = op->d.wholerow.tupdesc;

5540

5542

5543 for (int i = 0; i < var_tupdesc->natts; i++)

5544 {

5547

5549 continue;

5551 continue;

5555 (errcode(ERRCODE_DATATYPE_MISMATCH),

5556 errmsg("table row type and query-specified row type do not match"),

5557 errdetail("Physical storage mismatch on dropped attribute at ordinal position %d.",

5558 i + 1)));

5559 }

5560 }

5561

5562

5563

5564

5565

5566

5570 dtuple = tuple->t_data;

5571

5572

5573

5574

5575

5576

5577

5580

5582 *op->resnull = false;

5583}

5584

5585void

5588{

5590

5591

5596 {

5597 *op->resvalue = (Datum) 0;

5598 *op->resnull = true;

5599 return;

5600 }

5601

5602

5604 op->d.var.attnum,

5605 op->resnull);

5606 *op->resvalue = d;

5607

5609 elog(ERROR, "failed to fetch attribute from slot");

5610}

5611

5612

5613

5614

5615

5616void

5619{

5622

5623

5624

5625

5626

5627

5628

5636}

5637

5638

5639

5640

5641

5642

5643

5644

5645

5646

5647

5648

5649

5650

5651

5652

5653

5654

5655

5656

5657

5658

5659

5660

5661

5662

5663

5664

5665

5666

5667

5668

5671 Datum newValue, bool newValueIsNull,

5672 Datum oldValue, bool oldValueIsNull)

5673{

5674 Assert(newValue != oldValue);

5675

5676 if (!newValueIsNull)

5677 {

5680 false,

5683 ;

5684 else

5688 }

5689 else

5690 {

5691

5692

5693

5694

5695

5696 newValue = (Datum) 0;

5697 }

5698

5699 if (!oldValueIsNull)

5700 {

5702 false,

5705 else

5707 }

5708

5709 return newValue;

5710}

5711

5712

5713

5714

5715

5716

5717

5718bool

5720{

5723

5729 {

5733

5736 {

5738

5740

5743

5745 }

5746 else

5749 return true;

5750 }

5751

5752 return false;

5753}

5754

5755

5756

5757

5758

5759

5760

5761bool

5763{

5765 bool isdistinct = false;

5768

5770 {

5773 }

5774

5778

5779

5782

5785

5788 {

5791

5794

5795 isdistinct = true;

5796 }

5797

5798

5801

5802 return isdistinct;

5803}

5804

5805

5806

5807

5808void

5811{

5813 int setno = op->d.agg_trans.setno;

5814

5816 *op->resvalue, *op->resnull);

5817}

5818

5819

5820

5821

5822void

5825{

5827 int setno = op->d.agg_trans.setno;

5828

5833}

5834

5835

5840{

5844

5845

5848

5849

5851

5852

5854

5857 fcinfo->isnull = false;

5858

5860

5863

5865}

5866

5867

5872{

5876

5877

5880

5881

5883

5884

5886

5889 fcinfo->isnull = false;

5890

5892

5893

5894

5895

5896

5897

5898

5899

5900

5901

5902

5903

5904

5905

5906

5909 newVal, fcinfo->isnull,

5912

5915

5917}

#define DatumGetArrayTypePCopy(X)

#define ARR_NULLBITMAP(a)

#define ARR_OVERHEAD_WITHNULLS(ndims, nitems)

#define DatumGetArrayTypeP(X)

#define ARR_OVERHEAD_NONULLS(ndims)

#define ARR_DATA_OFFSET(a)

ArrayType * construct_empty_array(Oid elmtype)

Datum array_map(Datum arrayd, ExprState *exprstate, ExprContext *econtext, Oid retType, ArrayMapState *amstate)

ArrayType * construct_md_array(Datum *elems, bool *nulls, int ndims, int *dims, int *lbs, Oid elmtype, int elmlen, bool elmbyval, char elmalign)

void array_bitmap_copy(bits8 *destbitmap, int destoffset, const bits8 *srcbitmap, int srcoffset, int nitems)

int ArrayGetNItems(int ndim, const int *dims)

void ArrayCheckBounds(int ndim, const int *dims, const int *lb)

#define InvalidAttrNumber

Datum current_database(PG_FUNCTION_ARGS)

Datum numeric_out(PG_FUNCTION_ARGS)

Timestamp GetSQLLocalTimestamp(int32 typmod)

Datum timestamptz_out(PG_FUNCTION_ARGS)

Datum timestamp_out(PG_FUNCTION_ARGS)

TimestampTz GetSQLCurrentTimestamp(int32 typmod)

bool bms_is_member(int x, const Bitmapset *a)

Datum boolout(PG_FUNCTION_ARGS)

static Datum values[MAXATTR]

#define PG_USED_FOR_ASSERTS_ONLY

#define pg_attribute_always_inline

#define StaticAssertDecl(condition, errmessage)

#define OidIsValid(objectId)

int64 nextval_internal(Oid relid, bool check_permissions)

TimeADT GetSQLLocalTime(int32 typmod)

Datum date_out(PG_FUNCTION_ARGS)

Datum time_out(PG_FUNCTION_ARGS)

DateADT GetSQLCurrentDate(void)

TimeTzADT * GetSQLCurrentTime(int32 typmod)

Datum timetz_out(PG_FUNCTION_ARGS)

static Datum DateADTGetDatum(DateADT X)

static Datum TimeTzADTPGetDatum(const TimeTzADT *X)

static Datum TimeADTGetDatum(TimeADT X)

Datum datumCopy(Datum value, bool typByVal, int typLen)

int errdatatype(Oid datatypeOid)

int errdomainconstraint(Oid datatypeOid, const char *conname)

bool domain_check_safe(Datum value, bool isnull, Oid domainType, void **extra, MemoryContext mcxt, Node *escontext)

int errdetail(const char *fmt,...)

int errdetail_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...)

int errcode(int sqlerrcode)

int errmsg(const char *fmt,...)

#define errsave(context,...)

#define ereport(elevel,...)

void ExecEvalParamExtern(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void ExecEvalFieldStoreForm(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void ExecEvalGroupingFunc(ExprState *state, ExprEvalStep *op)

static void CheckVarSlotCompatibility(TupleTableSlot *slot, int attnum, Oid vartype)

void ExecEvalRow(ExprState *state, ExprEvalStep *op)

static pg_attribute_always_inline Datum ExecJustVarVirtImpl(ExprState *state, TupleTableSlot *slot, bool *isnull)

static pg_attribute_always_inline Datum ExecJustAssignVarImpl(ExprState *state, TupleTableSlot *inslot, bool *isnull)

void ExecEvalFieldStoreDeForm(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void ExecEvalCurrentOfExpr(ExprState *state, ExprEvalStep *op)

void ExecEvalSQLValueFunction(ExprState *state, ExprEvalStep *op)

void ExecEvalRowNull(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op)

void ExecEvalParamSet(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

static Datum ExecJustAssignInnerVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)

static char * GetJsonBehaviorValueString(JsonBehavior *behavior)

void ExecEvalCoerceViaIOSafe(ExprState *state, ExprEvalStep *op)

static Datum ExecJustScanVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)

static Datum ExecJustApplyFuncToCase(ExprState *state, ExprContext *econtext, bool *isnull)

Datum ExecInterpExprStillValid(ExprState *state, ExprContext *econtext, bool *isNull)

static pg_attribute_always_inline void ExecAggPlainTransByVal(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup, ExprContext *aggcontext, int setno)

struct ScalarArrayOpExprHashEntry ScalarArrayOpExprHashEntry

static Datum ExecJustAssignScanVar(ExprState *state, ExprContext *econtext, bool *isnull)

static pg_attribute_always_inline Datum ExecJustHashVarImpl(ExprState *state, TupleTableSlot *slot, bool *isnull)

void ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

static Datum ExecJustHashInnerVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)

bool ExecEvalPreOrderedDistinctMulti(AggState *aggstate, AggStatePerTrans pertrans)

void ExecEvalFieldSelect(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

struct ScalarArrayOpExprHashTable ScalarArrayOpExprHashTable

static Datum ExecJustInnerVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)

static Datum ExecJustHashInnerVarWithIV(ExprState *state, ExprContext *econtext, bool *isnull)

int ExecEvalJsonExprPath(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void ExecEvalConstraintNotNull(ExprState *state, ExprEvalStep *op)

static void ExecInitInterpreter(void)

void ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op)

void ExecEvalAggOrderedTransDatum(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

static Datum ExecJustConst(ExprState *state, ExprContext *econtext, bool *isnull)

static Datum ExecJustOuterVar(ExprState *state, ExprContext *econtext, bool *isnull)

void ExecEvalParamExec(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void ExecEvalJsonCoercion(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void ExecAggInitGroup(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup, ExprContext *aggcontext)

static pg_attribute_always_inline Datum ExecJustAssignVarVirtImpl(ExprState *state, TupleTableSlot *inslot, bool *isnull)

void ExecEvalNextValueExpr(ExprState *state, ExprEvalStep *op)

void ExecEvalSysVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext, TupleTableSlot *slot)

static bool saop_hash_element_match(struct saophash_hash *tb, Datum key1, Datum key2)

void ExecEvalMinMax(ExprState *state, ExprEvalStep *op)

void ExecEvalSubPlan(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void ExecEvalJsonIsPredicate(ExprState *state, ExprEvalStep *op)

static uint32 saop_element_hash(struct saophash_hash *tb, Datum key)

static Datum ExecJustInnerVar(ExprState *state, ExprContext *econtext, bool *isnull)

Datum ExecAggCopyTransValue(AggState *aggstate, AggStatePerTrans pertrans, Datum newValue, bool newValueIsNull, Datum oldValue, bool oldValueIsNull)

static Datum ExecJustAssignInnerVar(ExprState *state, ExprContext *econtext, bool *isnull)

static Datum ExecJustHashOuterVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)

void ExecEvalMergeSupportFunc(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void CheckExprStillValid(ExprState *state, ExprContext *econtext)

void ExecEvalJsonConstructor(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void ExecEvalJsonCoercionFinish(ExprState *state, ExprEvalStep *op)

static pg_attribute_always_inline Datum ExecJustHashVarVirtImpl(ExprState *state, TupleTableSlot *slot, bool *isnull)

void ExecReadyInterpretedExpr(ExprState *state)

static char * ExecGetJsonValueItemString(JsonbValue *item, bool *resnull)

static Datum ExecJustAssignScanVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)

static void ExecEvalRowNullInt(ExprState *state, ExprEvalStep *op, ExprContext *econtext, bool checkisnull)

void ExecEvalRowNotNull(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

static Datum ExecJustHashOuterVarStrict(ExprState *state, ExprContext *econtext, bool *isnull)

ExprEvalOp ExecEvalStepOp(ExprState *state, ExprEvalStep *op)

static Datum ExecJustAssignOuterVar(ExprState *state, ExprContext *econtext, bool *isnull)

static Datum ExecJustHashOuterVar(ExprState *state, ExprContext *econtext, bool *isnull)

static Datum ExecJustAssignOuterVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)

void ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op)

void ExecEvalArrayCoerce(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

static void CheckOpSlotCompatibility(ExprEvalStep *op, TupleTableSlot *slot)

void ExecEvalFuncExprStrictFusage(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

static Datum ExecJustOuterVarVirt(ExprState *state, ExprContext *econtext, bool *isnull)

static Datum ExecJustScanVar(ExprState *state, ExprContext *econtext, bool *isnull)

static Datum ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)

static pg_attribute_always_inline Datum ExecJustVarImpl(ExprState *state, TupleTableSlot *slot, bool *isnull)

void ExecEvalFuncExprFusage(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

void ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op)

bool ExecEvalPreOrderedDistinctSingle(AggState *aggstate, AggStatePerTrans pertrans)

#define EEO_OPCODE(opcode)

static pg_attribute_always_inline void ExecAggPlainTransByRef(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup, ExprContext *aggcontext, int setno)

void ExecEvalAggOrderedTransTuple(ExprState *state, ExprEvalStep *op, ExprContext *econtext)

static TupleDesc get_cached_rowtype(Oid type_id, int32 typmod, ExprEvalRowtypeCache *rowcache, bool *changed)

static Datum ExecJustHashInnerVar(ExprState *state, ExprContext *econtext, bool *isnull)

#define EEO_FLAG_INTERPRETER_INITIALIZED

#define EEO_FLAG_DIRECT_THREADED

@ EEOP_FUNCEXPR_STRICT_FUSAGE

@ EEOP_HASHDATUM_NEXT32_STRICT

@ EEOP_JSONEXPR_COERCION_FINISH

@ EEOP_HASHDATUM_FIRST_STRICT

@ EEOP_AGG_PLAIN_PERGROUP_NULLCHECK

@ EEOP_AGG_STRICT_DESERIALIZE

@ EEOP_BOOLTEST_IS_NOT_FALSE

@ EEOP_AGG_PLAIN_TRANS_BYREF

@ EEOP_AGG_PRESORTED_DISTINCT_MULTI

@ EEOP_AGG_PLAIN_TRANS_BYVAL

@ EEOP_NULLTEST_ROWISNOTNULL

@ EEOP_ASSIGN_TMP_MAKE_RO

@ EEOP_BOOL_OR_STEP_FIRST

@ EEOP_AGG_STRICT_INPUT_CHECK_NULLS

@ EEOP_AGG_STRICT_INPUT_CHECK_ARGS_1

@ EEOP_AGG_STRICT_INPUT_CHECK_ARGS

@ EEOP_NULLTEST_ROWISNULL

@ EEOP_NULLTEST_ISNOTNULL

@ EEOP_MERGE_SUPPORT_FUNC

@ EEOP_AGG_PRESORTED_DISTINCT_SINGLE

@ EEOP_BOOL_AND_STEP_FIRST

@ EEOP_DOMAIN_TESTVAL_EXT

@ EEOP_BOOL_AND_STEP_LAST

@ EEOP_AGG_ORDERED_TRANS_DATUM

@ EEOP_HASHDATUM_SET_INITVAL

@ EEOP_AGG_PLAIN_TRANS_STRICT_BYREF

@ EEOP_BOOLTEST_IS_NOT_TRUE

@ EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYVAL

@ EEOP_AGG_PLAIN_TRANS_STRICT_BYVAL

@ EEOP_AGG_PLAIN_TRANS_INIT_STRICT_BYREF

@ EEOP_HASHED_SCALARARRAYOP

@ EEOP_AGG_ORDERED_TRANS_TUPLE

TupleTableSlot * ExecFilterJunk(JunkFilter *junkfilter, TupleTableSlot *slot)

TupleDesc BlessTupleDesc(TupleDesc tupdesc)

const TupleTableSlotOps TTSOpsVirtual

TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)

void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList)

const TupleTableSlotOps TTSOpsBufferHeapTuple

const TupleTableSlotOps TTSOpsHeapTuple

#define EEO_FLAG_NEW_IS_NULL

#define EEO_FLAG_OLD_IS_NULL

Datum(* ExprStateEvalFunc)(struct ExprState *expression, struct ExprContext *econtext, bool *isNull)

static RangeTblEntry * exec_rt_fetch(Index rti, EState *estate)

static bool ExecQual(ExprState *state, ExprContext *econtext)

ExpandedObjectHeader * DatumGetEOHP(Datum d)

void DeleteExpandedObject(Datum d)

Datum MakeExpandedObjectReadOnlyInternal(Datum d)

#define DatumIsReadWriteExpandedObject(d, isnull, typlen)

static Datum expanded_record_get_field(ExpandedRecordHeader *erh, int fnumber, bool *isnull)

static TupleDesc expanded_record_get_tupdesc(ExpandedRecordHeader *erh)

Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)

void fmgr_info(Oid functionId, FmgrInfo *finfo)

Datum Int64GetDatum(int64 X)

#define DatumGetHeapTupleHeader(X)

#define DatumGetTextPP(X)

#define SizeForFunctionCallInfo(nargs)

#define InitFunctionCallInfoData(Fcinfo, Flinfo, Nargs, Collation, Context, Resultinfo)

#define DirectFunctionCall1(func, arg1)

#define LOCAL_FCINFO(name, nargs)

#define FunctionCallInvoke(fcinfo)

#define fmgr_info_set_expr(expr, finfo)

char * format_type_be(Oid type_oid)

static Datum HeapTupleGetDatum(const HeapTupleData *tuple)

Assert(PointerIsAligned(start, uint64))

HeapTuple toast_build_flattened_tuple(TupleDesc tupleDesc, Datum *values, bool *isnull)

HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)

bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)

void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *values, bool *isnull)

Datum heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc)

static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)

static void HeapTupleHeaderSetTypMod(HeapTupleHeaderData *tup, int32 typmod)

static int32 HeapTupleHeaderGetTypMod(const HeapTupleHeaderData *tup)

static void HeapTupleHeaderSetTypeId(HeapTupleHeaderData *tup, Oid datum_typeid)

static uint32 HeapTupleHeaderGetDatumLength(const HeapTupleHeaderData *tup)

static Oid HeapTupleHeaderGetTypeId(const HeapTupleHeaderData *tup)

Datum bool_int4(PG_FUNCTION_ARGS)

if(TABLE==NULL||TABLE_index==NULL)

static void ItemPointerSetInvalid(ItemPointerData *pointer)

Datum json_build_array_worker(int nargs, const Datum *args, const bool *nulls, const Oid *types, bool absent_on_null)

Datum json_build_object_worker(int nargs, const Datum *args, const bool *nulls, const Oid *types, bool absent_on_null, bool unique_keys)

Datum datum_to_json(Datum val, JsonTypeCategory tcategory, Oid outfuncoid)

bool json_validate(text *json, bool check_unique_keys, bool throw_error)

@ JSON_TOKEN_OBJECT_START

Datum jsonb_from_text(text *js, bool unique_keys)

Datum jsonb_build_array_worker(int nargs, const Datum *args, const bool *nulls, const Oid *types, bool absent_on_null)

Datum jsonb_in(PG_FUNCTION_ARGS)

Datum jsonb_out(PG_FUNCTION_ARGS)

Datum jsonb_build_object_worker(int nargs, const Datum *args, const bool *nulls, const Oid *types, bool absent_on_null, bool unique_keys)

Datum datum_to_jsonb(Datum val, JsonTypeCategory tcategory, Oid outfuncoid)

#define JB_ROOT_IS_OBJECT(jbp_)

static Datum JsonbPGetDatum(const Jsonb *p)

#define JB_ROOT_IS_ARRAY(jbp_)

static Jsonb * DatumGetJsonbP(Datum d)

#define JB_ROOT_IS_SCALAR(jbp_)

Jsonb * JsonbValueToJsonb(JsonbValue *val)

Datum json_populate_type(Datum json_val, Oid json_type, Oid typid, int32 typmod, void **cache, MemoryContext mcxt, bool *isnull, bool omit_quotes, Node *escontext)

JsonTokenType json_get_first_token(text *json, bool throw_error)

static JsonPath * DatumGetJsonPathP(Datum d)

bool JsonPathExists(Datum jb, JsonPath *jp, bool *error, List *vars)

Datum JsonPathQuery(Datum jb, JsonPath *jp, JsonWrapper wrapper, bool *empty, bool *error, List *vars, const char *column_name)

JsonbValue * JsonPathValue(Datum jb, JsonPath *jp, bool *empty, bool *error, List *vars, const char *column_name)

List * lappend(List *list, void *datum)

void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, char *typalign)

char * pstrdup(const char *in)

void pfree(void *pointer)

void * palloc0(Size size)

MemoryContext CurrentMemoryContext

MemoryContext MemoryContextGetParent(MemoryContext context)

#define AllocSizeIsValid(size)

#define SOFT_ERROR_OCCURRED(escontext)

Datum current_user(PG_FUNCTION_ARGS)

Datum session_user(PG_FUNCTION_ARGS)

Datum current_schema(PG_FUNCTION_ARGS)

Oid exprType(const Node *expr)

void ExecSetParamPlan(SubPlanState *node, ExprContext *econtext)

Datum ExecSubPlan(SubPlanState *node, ExprContext *econtext, bool *isNull)

#define IsA(nodeptr, _type_)

#define castNode(_type_, nodeptr)

static Datum NumericGetDatum(Numeric X)

static MemoryContext MemoryContextSwitchTo(MemoryContext context)

FormData_pg_attribute * Form_pg_attribute

static uint32 pg_rotate_left32(uint32 word, int n)

static int list_length(const List *l)

#define forboth(cell1, list1, cell2, list2)

void pgstat_init_function_usage(FunctionCallInfo fcinfo, PgStat_FunctionCallUsage *fcu)

void pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize)

#define qsort(a, b, c, d)

static uint32 DatumGetUInt32(Datum X)

static bool DatumGetBool(Datum X)

static Datum PointerGetDatum(const void *X)

static Datum Int16GetDatum(int16 X)

static Datum BoolGetDatum(bool X)

static char * DatumGetCString(Datum X)

static Pointer DatumGetPointer(Datum X)

static Datum CStringGetDatum(const char *X)

static Datum Int32GetDatum(int32 X)

static Datum UInt32GetDatum(uint32 X)

static int32 DatumGetInt32(Datum X)

@ SVFOP_CURRENT_TIMESTAMP

@ SVFOP_CURRENT_TIMESTAMP_N

static chr element(struct vars *v, const chr *startp, const chr *endp)

static unsigned hash(unsigned *uv, int n)

void check_stack_depth(void)

void appendStringInfo(StringInfo str, const char *fmt,...)

void initStringInfo(StringInfo str)

TupleTableSlot * sortslot

Tuplesortstate ** sortstates

TupleTableSlot * uniqslot

FunctionCallInfo transfn_fcinfo

AggStatePerGroup * all_pergroups

ExprContext * curaggcontext

AggStatePerTrans curpertrans

Index es_range_table_size

ParamListInfo ecxt_param_list_info

MemoryContext ecxt_per_tuple_memory

TupleTableSlot * ecxt_innertuple

ParamExecData * ecxt_param_exec_vals

TupleTableSlot * ecxt_newtuple

TupleTableSlot * ecxt_scantuple

TupleTableSlot * ecxt_oldtuple

MemoryContext ecxt_per_query_memory

struct EState * ecxt_estate

TupleTableSlot * ecxt_outertuple

struct ExprEvalStep::@55::@90 hashedscalararrayop

struct ExprEvalStep::@55::@57 var

struct ScalarArrayOpExprHashTable * elements_tab

AggStatePerTrans pertrans

struct JsonExprState * jsestate

struct ExprEvalStep::@55::@86 hashdatum_initvalue

FunctionCallInfo fcinfo_data

ErrorSaveContext * escontext

union ExprEvalStep::@55 d

struct ExprEvalStep::@55::@87 hashdatum

ExprEvalRowtypeCache rowcache

struct JsonConstructorExprState * jcstate

struct ExprEvalStep::@55::@56 fetch

NullableDatum args[FLEXIBLE_ARRAY_MEMBER]

JsonConstructorExpr * constructor

struct JsonConstructorExprState::@105 * arg_type_cache

JsonReturning * returning

FunctionCallInfo input_fcinfo

ErrorSaveContext escontext

NullableDatum formatted_expr

JsonReturning * returning

JsonFormatType format_type

MergeActionState * mt_merge_action

ParamExternData params[FLEXIBLE_ARRAY_MEMBER]

ParamFetchHook paramFetch

FunctionCallInfoBaseData hash_fcinfo_data

TupleDesc tts_tupleDescriptor

const TupleTableSlotOps *const tts_ops

uint64 tupDesc_identifier

TupleConversionMap * convert_tuples_by_name(TupleDesc indesc, TupleDesc outdesc)

HeapTuple execute_attr_map_tuple(HeapTuple tuple, TupleConversionMap *map)

void DecrTupleDescRefCount(TupleDesc tupdesc)

void IncrTupleDescRefCount(TupleDesc tupdesc)

TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)

#define ReleaseTupleDesc(tupdesc)

static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)

static CompactAttribute * TupleDescCompactAttr(TupleDesc tupdesc, int i)

struct TupleDescData * TupleDesc

void tuplesort_putdatum(Tuplesortstate *state, Datum val, bool isNull)

void tuplesort_puttupleslot(Tuplesortstate *state, TupleTableSlot *slot)

#define att_align_nominal(cur_offset, attalign)

#define att_addlength_pointer(cur_offset, attlen, attptr)

static Datum fetch_att(const void *T, bool attbyval, int attlen)

#define TTS_IS_VIRTUAL(slot)

static void slot_getsomeattrs(TupleTableSlot *slot, int attnum)

static Datum slot_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)

static Datum slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull)

static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)

static void slot_getallattrs(TupleTableSlot *slot)

static TupleTableSlot * ExecCopySlot(TupleTableSlot *dstslot, TupleTableSlot *srcslot)

TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod)

TupleDesc lookup_rowtype_tupdesc_domain(Oid type_id, int32 typmod, bool noError)

TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)

#define TYPECACHE_TUPDESC

static Datum TimestampTzGetDatum(TimestampTz X)

static Datum TimestampGetDatum(Timestamp X)

#define VARATT_IS_EXTERNAL_EXPANDED(PTR)

#define SET_VARSIZE(PTR, len)

text * cstring_to_text_with_len(const char *s, int len)

Datum textin(PG_FUNCTION_ARGS)

xmltype * xmlroot(xmltype *data, text *version, int standalone)

text * xmltotext_with_options(xmltype *data, XmlOptionType xmloption_arg, bool indent)

char * map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings)

xmltype * xmlconcat(List *args)

bool xml_is_document(xmltype *arg)

xmltype * xmlparse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace)

xmltype * xmlelement(XmlExpr *xexpr, Datum *named_argvalue, bool *named_argnull, Datum *argvalue, bool *argnull)

xmltype * xmlpi(const char *target, text *arg, bool arg_is_null, bool *result_is_null)

static xmltype * DatumGetXmlP(Datum X)