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

32

54

55

57{

58

59

60

61

67

70

73 Datum *resv, bool *resnull);

75 Oid funcid, Oid inputcollid,

79 Datum *resv, bool *resnull);

89 Datum *resv, bool *resnull);

93 Datum *resv, bool *resnull);

97 int transno, int setno, int setoff, bool ishash,

98 bool nullcheck);

100 Datum *resv, bool *resnull,

104 bool exists_coerce,

105 Datum *resv, bool *resnull);

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

144{

147

148

149 if (node == NULL)

150 return NULL;

151

152

154 state->expr = node;

155 state->parent = parent;

156 state->ext_params = NULL;

157

158

160

161

163

164

167

169

171}

172

173

174

175

176

177

178

181{

184

185

186 if (node == NULL)

187 return NULL;

188

189

191 state->expr = node;

192 state->parent = NULL;

193 state->ext_params = ext_params;

194

195

197

198

200

201

204

206

208}

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

230{

233 List *adjust_jumps = NIL;

234

235

236 if (qual == NIL)

237 return NULL;

238

240

243 state->parent = parent;

244 state->ext_params = NULL;

245

246

248

249

251

252

253

254

255

256

257

258

260

261

262

263

266

268 {

269

271

272

276 state->steps_len - 1);

277 }

278

279

281 {

283

287 }

288

289

290

291

292

293

296

298

300}

301

302

303

304

305

306

307

308

309

310

311

312

313

316{

317

318 if (qual == NIL)

319 return NULL;

320

322

323

324

325

326

327

329}

330

331

332

333

336{

339

340 foreach(lc, nodes)

341 {

343

345 }

346

347 return result;

348}

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

375{

380

382

385 state->expr = (Expr *) targetList;

386 state->parent = parent;

387 state->ext_params = NULL;

388

389 state->resultslot = slot;

390

391

393

394

395 foreach(lc, targetList)

396 {

400 bool isSafeVar = false;

401

402

403

404

405

406

407

408

409

410 if (tle->expr != NULL &&

412 ((Var *) tle->expr)->varattno > 0)

413 {

414

417

418 if (inputDesc == NULL)

419 isSafeVar = true;

420 else if (attnum <= inputDesc->natts)

421 {

423

424

425

426

427

428

429 if (!attr->attisdropped && variable->vartype == attr->atttypid)

430 {

431 isSafeVar = true;

432 }

433 }

434 }

435

436 if (isSafeVar)

437 {

438

440 {

442

444 break;

445

447

449 break;

450

451

452

453 default:

454

455

456

457

458

459 switch (variable->varreturningtype)

460 {

463 break;

467 break;

471 break;

472 }

473 break;

474 }

475

479 }

480 else

481 {

482

483

484

485

486

487

488

489

492

493

494

495

496

499 else

503 }

504 }

505

508

510

511 return projInfo;

512}

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

548 bool evalTargetList,

549 List *targetColnos,

554{

557 int nAssignableCols;

558 bool sawJunk;

562 int outerattnum;

564 *lc2;

565

567

570 if (evalTargetList)

571 state->expr = (Expr *) targetList;

572 else

573 state->expr = NULL;

574 state->parent = parent;

575 state->ext_params = NULL;

576

577 state->resultslot = slot;

578

579

580

581

582

583 nAssignableCols = 0;

584 sawJunk = false;

585 foreach(lc, targetList)

586 {

588

589 if (tle->resjunk)

590 sawJunk = true;

591 else

592 {

593 if (sawJunk)

594 elog(ERROR, "subplan target list is out of order");

595 nAssignableCols++;

596 }

597 }

598

599

600 if (nAssignableCols != list_length(targetColnos))

601 elog(ERROR, "targetColnos does not match subplan target list");

602

603

604

605

606

607

608 assignedCols = NULL;

609 foreach(lc, targetColnos)

610 {

612

613 assignedCols = bms_add_member(assignedCols, targetattnum);

614 }

615

616

617

618

619

620

622 {

624

626 continue;

628 continue;

630 break;

631 }

632

633

634

635

636

637

638 if (evalTargetList)

640 else

642

644

645

646

647

648

649

650

651

652 outerattnum = 0;

653 forboth(lc, targetList, lc2, targetColnos)

654 {

658

659 Assert(!tle->resjunk);

660

661

662

663

664 if (targetattnum <= 0 || targetattnum > relDesc->natts)

666 (errcode(ERRCODE_DATATYPE_MISMATCH),

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

668 errdetail("Query has too many columns.")));

670

671 if (attr->attisdropped)

673 (errcode(ERRCODE_DATATYPE_MISMATCH),

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

675 errdetail("Query provides a value for a dropped column at ordinal position %d.",

676 targetattnum)));

679 (errcode(ERRCODE_DATATYPE_MISMATCH),

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

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

683 targetattnum,

685

686

687 if (evalTargetList)

688 {

689

690

691

692

693

694

697

701 }

702 else

703 {

704

709 }

710 outerattnum++;

711 }

712

713

714

715

716

718 {

720

722 {

723

730

734 }

736 {

737

742 }

743 }

744

747

749

750 return projInfo;

751}

752

753

754

755

756

757

758

759

760

761

762

763

766{

769

771

773

775

777

778 return result;

779}

780

781

782

783

784

785

786

787

788

789

790

791

794{

797

799

801

803

805

806 return result;

807}

808

809

810

811

812

813

814

817{

820

822

824

826

828

829 return result;

830}

831

832

833

834

835

836

837

840{

844

845

847

848 foreach(lc, nodes)

849 {

851

853 }

854

856

857 return result;

858}

859

860

861

862

863

864

865

866

867

868

869

870

871bool

873{

875 bool isnull;

876

877

878 if (state == NULL)

879 return true;

880

881

883

885

886 if (isnull)

887 return true;

888

890}

891

892

893

894

895

896

897

898

899

900

901static void

903{

905 return;

906

908}

909

910

911

912

913

914

915

916

917

918static void

920 Datum *resv, bool *resnull)

921{

923

924

926

927

928 Assert(resv != NULL && resnull != NULL);

930 scratch.resnull = resnull;

931

932

934 {

935 case T_Var:

936 {

938

940 {

941

943 }

944 else if (variable->varattno <= 0)

945 {

946

951 {

954 break;

957 break;

958

959

960

961 default:

962 switch (variable->varreturningtype)

963 {

966 break;

970 break;

974 break;

975 }

976 break;

977 }

978 }

979 else

980 {

981

986 {

989 break;

992 break;

993

994

995

996 default:

997 switch (variable->varreturningtype)

998 {

1001 break;

1005 break;

1009 break;

1010 }

1011 break;

1012 }

1013 }

1014

1016 break;

1017 }

1018

1019 case T_Const:

1020 {

1022

1026

1028 break;

1029 }

1030

1031 case T_Param:

1032 {

1035

1037 {

1043 break;

1045

1046

1047

1048

1049

1050

1051

1052 if (state->ext_params)

1053 params = state->ext_params;

1054 else if (state->parent &&

1055 state->parent->state)

1056 params = state->parent->state->es_param_list_info;

1057 else

1058 params = NULL;

1060 {

1062 resv, resnull);

1063 }

1064 else

1065 {

1070 }

1071 break;

1072 default:

1073 elog(ERROR, "unrecognized paramkind: %d",

1075 break;

1076 }

1077 break;

1078 }

1079

1080 case T_Aggref:

1081 {

1083

1086

1088 {

1090

1092 }

1093 else

1094 {

1095

1096 elog(ERROR, "Aggref found in non-Agg plan node");

1097 }

1098

1100 break;

1101 }

1102

1103 case T_GroupingFunc:

1104 {

1106 Agg *agg;

1107

1110 elog(ERROR, "GroupingFunc found in non-Agg plan node");

1111

1113

1114 agg = (Agg *) (state->parent->plan);

1115

1118 else

1120

1122 break;

1123 }

1124

1125 case T_WindowFunc:

1126 {

1129

1130 wfstate->wfunc = wfunc;

1131

1133 {

1135 int nfuncs;

1136

1138 nfuncs = ++winstate->numfuncs;

1139 if (wfunc->winagg)

1141

1142

1147

1148

1149

1150

1151

1152

1153

1154 if (nfuncs != winstate->numfuncs)

1156 (errcode(ERRCODE_WINDOWING_ERROR),

1157 errmsg("window function calls cannot be nested")));

1158 }

1159 else

1160 {

1161

1162 elog(ERROR, "WindowFunc found in non-WindowAgg plan node");

1163 }

1164

1168 break;

1169 }

1170

1171 case T_MergeSupportFunc:

1172 {

1173

1174 if (state->parent ||

1177 elog(ERROR, "MergeSupportFunc found in non-merge plan node");

1178

1181 break;

1182 }

1183

1184 case T_SubscriptingRef:

1185 {

1187

1189 break;

1190 }

1191

1192 case T_FuncExpr:

1193 {

1195

1197 func->args, func->funcid, func->inputcollid,

1200 break;

1201 }

1202

1203 case T_OpExpr:

1204 {

1206

1208 op->args, op->opfuncid, op->inputcollid,

1211 break;

1212 }

1213

1214 case T_DistinctExpr:

1215 {

1217

1219 op->args, op->opfuncid, op->inputcollid,

1221

1222

1223

1224

1225

1226

1227

1228

1229

1230

1233 break;

1234 }

1235

1236 case T_NullIfExpr:

1237 {

1239

1241 op->args, op->opfuncid, op->inputcollid,

1243

1244

1245

1246

1247

1248

1251

1252

1253

1254

1255

1256

1257

1258

1259

1260

1263 break;

1264 }

1265

1266 case T_ScalarArrayOpExpr:

1267 {

1269 Expr *scalararg;

1270 Expr *arrayarg;

1274 Oid cmpfuncid;

1275

1276

1277

1278

1279

1280

1281

1283 {

1285 cmpfuncid = opexpr->negfuncid;

1286 }

1287 else

1288 cmpfuncid = opexpr->opfuncid;

1289

1293

1294

1295 aclresult = object_aclcheck(ProcedureRelationId, cmpfuncid,

1302

1304 {

1305 aclresult = object_aclcheck(ProcedureRelationId, opexpr->hashfuncid,

1312 }

1313

1314

1320 opexpr->inputcollid, NULL, NULL);

1321

1322

1323

1324

1325

1326

1327

1328

1330 {

1331

1334

1335

1336

1337

1338

1339

1340

1341

1343

1344

1350

1351

1353 }

1354 else

1355 {

1356

1360

1361

1362

1363

1364

1365

1366

1368

1369

1377 }

1378 break;

1379 }

1380

1381 case T_BoolExpr:

1382 {

1385 List *adjust_jumps = NIL;

1386 int off;

1388

1389

1392

1393

1394

1395

1396

1397

1398

1399

1400

1401

1402

1403

1404

1405

1406 off = 0;

1407 foreach(lc, boolexpr->args)

1408 {

1410

1411

1413

1414

1415 switch (boolexpr->boolop)

1416 {

1419

1420 if (off == 0)

1422 else if (off + 1 == nargs)

1424 else

1426 break;

1429

1430 if (off == 0)

1432 else if (off + 1 == nargs)

1434 else

1436 break;

1439

1441 break;

1442 default:

1443 elog(ERROR, "unrecognized boolop: %d",

1444 (int) boolexpr->boolop);

1445 break;

1446 }

1447

1450 adjust_jumps = lappend_int(adjust_jumps,

1451 state->steps_len - 1);

1452 off++;

1453 }

1454

1455

1456 foreach(lc, adjust_jumps)

1457 {

1459

1462 }

1463

1464 break;

1465 }

1466

1467 case T_SubPlan:

1468 {

1470

1471

1472

1473

1474

1475

1476

1478 {

1483 break;

1484 }

1485

1487 break;

1488 }

1489

1490 case T_FieldSelect:

1491 {

1493

1494

1496

1497

1502

1504 break;

1505 }

1506

1507 case T_FieldStore:

1508 {

1513 bool *nulls;

1514 int ncolumns;

1516 *l2;

1517

1518

1520 ncolumns = tupDesc->natts;

1522

1523

1525 nulls = (bool *) palloc(sizeof(bool) * ncolumns);

1526

1527

1530

1531

1533

1534

1542

1543

1545 {

1548 Datum *save_innermost_caseval;

1549 bool *save_innermost_casenull;

1550

1551 if (fieldnum <= 0 || fieldnum > ncolumns)

1552 elog(ERROR, "field number %d is out of range in FieldStore",

1553 fieldnum);

1554

1555

1556

1557

1558

1559

1560

1561

1562

1563

1564

1565

1566

1567

1568

1569

1570

1571

1572

1573

1574

1575

1576

1577

1578

1579 save_innermost_caseval = state->innermost_caseval;

1580 save_innermost_casenull = state->innermost_casenull;

1581 state->innermost_caseval = &values[fieldnum - 1];

1582 state->innermost_casenull = &nulls[fieldnum - 1];

1583

1585 &values[fieldnum - 1],

1586 &nulls[fieldnum - 1]);

1587

1588 state->innermost_caseval = save_innermost_caseval;

1589 state->innermost_casenull = save_innermost_casenull;

1590 }

1591

1592

1600 break;

1601 }

1602

1603 case T_RelabelType:

1604 {

1605

1607

1609 break;

1610 }

1611

1612 case T_CoerceViaIO:

1613 {

1615 Oid iofunc;

1616 bool typisvarlena;

1617 Oid typioparam;

1619

1620

1622

1623

1624

1625

1626

1627

1628

1629

1630

1631 if (state->escontext == NULL)

1633 else

1635

1636

1639

1641 &iofunc, &typisvarlena);

1647

1648

1651

1653 &iofunc, &typioparam);

1659

1660

1661

1662

1663

1669

1671

1673 break;

1674 }

1675

1676 case T_ArrayCoerceExpr:

1677 {

1679 Oid resultelemtype;

1681

1682

1684

1688 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),

1689 errmsg("target type is not an array")));

1690

1691

1692

1693

1694

1695

1696

1701

1704

1707

1708 if (elemstate->steps_len == 1 &&

1710 {

1711

1712 elemstate = NULL;

1713 }

1714 else

1715 {

1716

1719

1721 }

1722

1726

1727 if (elemstate)

1728 {

1729

1732 }

1733 else

1734 {

1735

1737 }

1738

1740 break;

1741 }

1742

1743 case T_ConvertRowtypeExpr:

1744 {

1747

1748

1750 rowcachep[0].cacheptr = NULL;

1751 rowcachep[1].cacheptr = NULL;

1752

1753

1755

1756

1764

1766 break;

1767 }

1768

1769

1770 case T_CaseExpr:

1771 {

1773 List *adjust_jumps = NIL;

1774 Datum *caseval = NULL;

1775 bool *casenull = NULL;

1777

1778

1779

1780

1781

1782

1783 if (caseExpr->arg != NULL)

1784 {

1785

1787 casenull = palloc(sizeof(bool));

1788

1790 caseval, casenull);

1791

1792

1793

1794

1795

1797 {

1798

1801 scratch.resnull = casenull;

1805

1807 scratch.resnull = resnull;

1808 }

1809 }

1810

1811

1812

1813

1814

1815

1816

1817 foreach(lc, caseExpr->args)

1818 {

1820 Datum *save_innermost_caseval;

1821 bool *save_innermost_casenull;

1822 int whenstep;

1823

1824

1825

1826

1827

1828

1829

1830

1831

1832

1833

1834 save_innermost_caseval = state->innermost_caseval;

1835 save_innermost_casenull = state->innermost_casenull;

1836 state->innermost_caseval = caseval;

1837 state->innermost_casenull = casenull;

1838

1839

1841

1842 state->innermost_caseval = save_innermost_caseval;

1843 state->innermost_casenull = save_innermost_casenull;

1844

1845

1847 scratch.d.jump.jumpdone = -1;

1849 whenstep = state->steps_len - 1;

1850

1851

1852

1853

1854

1856

1857

1859 scratch.d.jump.jumpdone = -1;

1861

1862

1863

1864

1865

1866 adjust_jumps = lappend_int(adjust_jumps,

1867 state->steps_len - 1);

1868

1869

1870

1871

1872

1873 state->steps[whenstep].d.jump.jumpdone = state->steps_len;

1874 }

1875

1876

1878

1879

1881 resv, resnull);

1882

1883

1884 foreach(lc, adjust_jumps)

1885 {

1887

1891 }

1892

1893 break;

1894 }

1895

1896 case T_CaseTestExpr:

1897 {

1898

1899

1900

1901

1902

1903

1904

1905

1906

1907 if (state->innermost_caseval == NULL)

1909 else

1910 {

1914 }

1916 break;

1917 }

1918

1919 case T_ArrayExpr:

1920 {

1922 int nelems = list_length(arrayexpr->elements);

1924 int elemoff;

1925

1926

1927

1928

1929

1930

1935 (bool *) palloc(sizeof(bool) * nelems);

1937

1938

1941

1942

1947

1948

1949 elemoff = 0;

1950 foreach(lc, arrayexpr->elements)

1951 {

1953

1957 elemoff++;

1958 }

1959

1960

1962 break;

1963 }

1964

1965 case T_RowExpr:

1966 {

1970 int i;

1972

1973

1974 if (rowexpr->row_typeid == RECORDOID)

1975 {

1976

1978

1980

1982 }

1983 else

1984 {

1985

1987 }

1988

1989

1990

1991

1992

1993

1994

1995

1996

1997 Assert(nelems <= tupdesc->natts);

1998 nelems = Max(nelems, tupdesc->natts);

1999

2000

2001

2002

2003

2006

2007

2011 (bool *) palloc(sizeof(bool) * nelems);

2012

2013 memset(scratch.d.row.elemnulls, true, sizeof(bool) * nelems);

2014

2015

2016 i = 0;

2017 foreach(l, rowexpr->args)

2018 {

2021

2022 if (!att->attisdropped)

2023 {

2024

2025

2026

2027

2028

2029

2032 (errcode(ERRCODE_DATATYPE_MISMATCH),

2033 errmsg("ROW() column has type %s instead of type %s",

2036 }

2037 else

2038 {

2039

2040

2041

2042

2043

2045 }

2046

2047

2051 i++;

2052 }

2053

2054

2056 break;

2057 }

2058

2059 case T_RowCompareExpr:

2060 {

2062 int nopers = list_length(rcexpr->opnos);

2063 List *adjust_jumps = NIL;

2065 *l_right_expr,

2066 *l_opno,

2067 *l_opfamily,

2068 *l_inputcollid;

2070

2071

2072

2073

2074

2075

2080

2082 l_right_expr, rcexpr->rargs,

2083 l_opno, rcexpr->opnos,

2084 l_opfamily, rcexpr->opfamilies,

2085 l_inputcollid, rcexpr->inputcollids)

2086 {

2092 int strategy;

2093 Oid lefttype;

2094 Oid righttype;

2095 Oid proc;

2098

2100 &strategy,

2101 &lefttype,

2102 &righttype);

2104 lefttype,

2105 righttype,

2108 elog(ERROR, "missing support function %d(%u,%u) in opfamily %u",

2109 BTORDER_PROC, lefttype, righttype, opfamily);

2110

2111

2117 inputcollid, NULL, NULL);

2118

2119

2120

2121

2122

2123

2124

2125

2126

2131

2136

2139

2141 adjust_jumps = lappend_int(adjust_jumps,

2142 state->steps_len - 1);

2143 }

2144

2145

2146

2147

2148

2149 if (nopers == 0)

2150 {

2155 }

2156

2157

2161

2162

2163 foreach(lc, adjust_jumps)

2164 {

2166

2170

2171

2173

2175 }

2176

2177 break;

2178 }

2179

2180 case T_CoalesceExpr:

2181 {

2183 List *adjust_jumps = NIL;

2185

2186

2188

2189

2190

2191

2192

2193 foreach(lc, coalesce->args)

2194 {

2196

2197

2199

2200

2202 scratch.d.jump.jumpdone = -1;

2204

2205 adjust_jumps = lappend_int(adjust_jumps,

2206 state->steps_len - 1);

2207 }

2208

2209

2210

2211

2212

2213

2214

2215

2216 foreach(lc, adjust_jumps)

2217 {

2219

2223 }

2224

2225 break;

2226 }

2227

2228 case T_MinMaxExpr:

2229 {

2236 int off;

2237

2238

2243 (errcode(ERRCODE_UNDEFINED_FUNCTION),

2244 errmsg("could not identify a comparison function for type %s",

2246

2247

2248

2249

2250

2251

2252

2253

2254

2260 minmaxexpr->inputcollid, NULL, NULL);

2261

2263

2267 (bool *) palloc(sizeof(bool) * nelems);

2269

2273

2274

2275 off = 0;

2276 foreach(lc, minmaxexpr->args)

2277 {

2279

2283 off++;

2284 }

2285

2286

2288 break;

2289 }

2290

2291 case T_SQLValueFunction:

2292 {

2294

2297

2299 break;

2300 }

2301

2302 case T_XmlExpr:

2303 {

2307 int off;

2309

2312

2313

2314 if (nnamed)

2315 {

2319 (bool *) palloc(sizeof(bool) * nnamed);

2320 }

2321 else

2322 {

2325 }

2326

2327 if (nargs)

2328 {

2332 (bool *) palloc(sizeof(bool) * nargs);

2333 }

2334 else

2335 {

2338 }

2339

2340

2341 off = 0;

2343 {

2345

2349 off++;

2350 }

2351

2352 off = 0;

2353 foreach(arg, xexpr->args)

2354 {

2356

2360 off++;

2361 }

2362

2363

2365 break;

2366 }

2367

2368 case T_JsonValueExpr:

2369 {

2371

2376 break;

2377 }

2378

2379 case T_JsonConstructorExpr:

2380 {

2385 int argno = 0;

2386

2387 if (ctor->func)

2388 {

2390 }

2393 {

2394

2396 }

2397 else

2398 {

2400

2402

2405

2408 jcstate->arg_nulls = (bool *) palloc(sizeof(bool) * nargs);

2410 jcstate->nargs = nargs;

2411

2412 foreach(lc, args)

2413 {

2415

2417

2419 {

2420

2422

2423 jcstate->arg_values[argno] = con->constvalue;

2424 jcstate->arg_nulls[argno] = con->constisnull;

2425 }

2426 else

2427 {

2431 }

2432 argno++;

2433 }

2434

2435

2437 {

2438 bool is_jsonb =

2440

2443

2444 for (int i = 0; i < nargs; i++)

2445 {

2447 Oid outfuncid;

2449

2451 &category, &outfuncid);

2452

2455 }

2456 }

2457

2459 }

2460

2462 {

2463 Datum *innermost_caseval = state->innermost_caseval;

2464 bool *innermost_isnull = state->innermost_casenull;

2465

2466 state->innermost_caseval = resv;

2467 state->innermost_casenull = resnull;

2468

2470

2471 state->innermost_caseval = innermost_caseval;

2472 state->innermost_casenull = innermost_isnull;

2473 }

2474 }

2475 break;

2476

2477 case T_JsonIsPredicate:

2478 {

2480

2482

2485

2487 break;

2488 }

2489

2490 case T_JsonExpr:

2491 {

2493

2494

2495

2496

2497

2498

2501 resv, resnull);

2502 else

2504 break;

2505 }

2506

2507 case T_NullTest:

2508 {

2510

2512 {

2513 if (ntest->argisrow)

2515 else

2517 }

2519 {

2520 if (ntest->argisrow)

2522 else

2524 }

2525 else

2526 {

2527 elog(ERROR, "unrecognized nulltesttype: %d",

2529 }

2530

2532

2533

2535 resv, resnull);

2536

2537

2539 break;

2540 }

2541

2542 case T_BooleanTest:

2543 {

2545

2546

2547

2548

2549

2550

2551

2553

2555 {

2558 break;

2561 break;

2564 break;

2567 break;

2569

2571 break;

2573

2575 break;

2576 default:

2577 elog(ERROR, "unrecognized booltesttype: %d",

2579 }

2580

2582 break;

2583 }

2584

2585 case T_CoerceToDomain:

2586 {

2588

2590 resv, resnull);

2591 break;

2592 }

2593

2594 case T_CoerceToDomainValue:

2595 {

2596

2597

2598

2599

2600

2601

2602

2603

2604 if (state->innermost_domainval == NULL)

2606 else

2607 {

2609

2612 }

2614 break;

2615 }

2616

2617 case T_CurrentOfExpr:

2618 {

2621 break;

2622 }

2623

2624 case T_NextValueExpr:

2625 {

2627

2631

2633 break;

2634 }

2635

2636 case T_ReturningExpr:

2637 {

2639 int retstep;

2640

2641

2647 retstep = state->steps_len - 1;

2648

2649

2651

2652

2653 state->steps[retstep].d.returningexpr.jumpdone = state->steps_len;

2654

2655

2658 else

2660

2661 break;

2662 }

2663

2664 default:

2665 elog(ERROR, "unrecognized node type: %d",

2667 break;

2668 }

2669}

2670

2671

2672

2673

2674

2675

2676

2677void

2679{

2681 {

2684 }

2686 {

2690 }

2691

2693}

2694

2695

2696

2697

2698

2699

2700

2701

2702

2703static void

2706{

2711 int argno;

2713

2714

2719

2720

2721

2722

2723

2724

2725

2728 (errcode(ERRCODE_TOO_MANY_ARGUMENTS),

2729 errmsg_plural("cannot pass more than %d argument to a function",

2730 "cannot pass more than %d arguments to a function",

2733

2734

2739

2740

2743

2744

2746 nargs, inputcollid, NULL, NULL);

2747

2748

2751

2752

2755 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),

2756 errmsg("set-valued function called in context that cannot accept a set"),

2760

2761

2762 argno = 0;

2763 foreach(lc, args)

2764 {

2766

2768 {

2769

2770

2771

2772

2774

2775 fcinfo->args[argno].value = con->constvalue;

2776 fcinfo->args[argno].isnull = con->constisnull;

2777 }

2778 else

2779 {

2783 }

2784 argno++;

2785 }

2786

2787

2788 if (pgstat_track_functions <= flinfo->fn_stats)

2789 {

2790 if (flinfo->fn_strict && nargs > 0)

2791 {

2792

2793 if (nargs == 1)

2795 else if (nargs == 2)

2797 else

2799 }

2800 else

2802 }

2803 else

2804 {

2805 if (flinfo->fn_strict && nargs > 0)

2807 else

2809 }

2810}

2811

2812

2813

2814

2815

2816

2817

2818

2819

2820static void

2823 Datum *resv, bool *resnull)

2824{

2829

2830 if (state->parent)

2831 elog(ERROR, "SubPlan found with no parent plan");

2832

2833

2834

2835

2836

2837

2838

2839

2840

2841

2842

2843

2844

2845

2848 {

2851

2854

2857

2860 }

2861

2863

2864

2866 sstate);

2867

2870 scratch.resnull = resnull;

2872

2874}

2875

2876

2877

2878

2879

2880static void

2882{

2884

2885

2887

2888

2890}

2891

2892

2893

2894

2895

2896static void

2898{

2901

2904

2905

2906

2907

2908

2910 {

2918 }

2920 {

2928 }

2930 {

2938 }

2940 {

2948 }

2950 {

2958 }

2959

2960

2961

2962

2963

2964

2965

2966

2968 {

2970

2972

2973

2976 }

2977}

2978

2979

2980

2981

2982static bool

2984{

2985 if (node == NULL)

2986 return false;

2988 {

2991

2993 {

2996 break;

2997

3000 break;

3001

3002

3003

3004 default:

3005 switch (variable->varreturningtype)

3006 {

3009 break;

3012 break;

3015 break;

3016 }

3017 break;

3018 }

3019 return false;

3020 }

3021

3022

3024 {

3026

3029 subplan);

3030 }

3031

3032

3033

3034

3035

3036

3037

3039 return false;

3041 return false;

3043 return false;

3045}

3046

3047

3048

3049

3050

3051

3052

3053

3054

3055

3056

3057

3058

3059

3060

3061static bool

3063{

3067 bool isfixed = false;

3069

3075

3077 {

3081 }

3082 else if (!parent)

3083 {

3084 isfixed = false;

3085 }

3087 {

3089

3091 {

3092 isfixed = false;

3093 }

3095 {

3096 isfixed = true;

3099 }

3100 else if (is)

3101 {

3104 }

3105 }

3107 {

3109

3111 {

3112 isfixed = false;

3113 }

3115 {

3116 isfixed = true;

3119 }

3120 else if (os)

3121 {

3124 }

3125 }

3129 {

3131

3133 tts_ops = parent->scanops;

3134

3137 }

3138

3139 if (isfixed && desc != NULL && tts_ops != NULL)

3140 {

3144 }

3145 else

3146 {

3150 }

3151

3152

3154 return false;

3155

3156 return true;

3157}

3158

3159

3160

3161

3162

3163static void

3165{

3167

3168

3175

3176

3181

3182

3183

3184

3185

3186

3187

3188

3189

3190

3191

3192

3193

3194 if (parent)

3195 {

3197

3198 switch (nodeTag(parent))

3199 {

3200 case T_SubqueryScanState:

3202 break;

3203 case T_CteScanState:

3204 subplan = ((CteScanState *) parent)->cteplanstate;

3205 break;

3206 default:

3207 break;

3208 }

3209

3210 if (subplan)

3211 {

3212 bool junk_filter_needed = false;

3214

3215

3217 {

3219

3220 if (tle->resjunk)

3221 {

3222 junk_filter_needed = true;

3223 break;

3224 }

3225 }

3226

3227

3228 if (junk_filter_needed)

3229 {

3234 }

3235 }

3236 }

3237}

3238

3239

3240

3241

3242static void

3245{

3246 bool isAssignment = (sbsref->refassgnexpr != NULL);

3252 char *ptr;

3253 List *adjust_jumps = NIL;

3255 int i;

3256

3257

3259 if (!sbsroutines)

3261 (errcode(ERRCODE_DATATYPE_MISMATCH),

3262 errmsg("cannot subscript type %s because it does not support subscripting",

3267

3268

3270 (nupper + nlower) * (sizeof(Datum) +

3271 2 * sizeof(bool)));

3272

3273

3275 sbsrefstate->numupper = nupper;

3276 sbsrefstate->numlower = nlower;

3277

3280 ptr += nupper * sizeof(Datum);

3282 ptr += nlower * sizeof(Datum);

3284 ptr += nupper * sizeof(bool);

3286 ptr += nlower * sizeof(bool);

3288 ptr += nupper * sizeof(bool);

3290

3291

3292

3293

3294

3295

3296

3297

3298 memset(&methods, 0, sizeof(methods));

3299 sbsroutines->exec_setup(sbsref, sbsrefstate, &methods);

3300

3301

3302

3303

3304

3305

3306

3308

3309

3310

3311

3312

3313

3314 if (!isAssignment && sbsroutines->fetch_strict)

3315 {

3317 scratch->d.jump.jumpdone = -1;

3319 adjust_jumps = lappend_int(adjust_jumps,

3320 state->steps_len - 1);

3321 }

3322

3323

3324 i = 0;

3326 {

3328

3329

3330 if (e)

3331 {

3334 }

3335 else

3336 {

3338

3342 }

3343 i++;

3344 }

3345

3346

3347 i = 0;

3349 {

3351

3352

3353 if (e)

3354 {

3357 }

3358 else

3359 {

3361

3365 }

3366 i++;

3367 }

3368

3369

3371 {

3377 adjust_jumps = lappend_int(adjust_jumps,

3378 state->steps_len - 1);

3379 }

3380

3381 if (isAssignment)

3382 {

3383 Datum *save_innermost_caseval;

3384 bool *save_innermost_casenull;

3385

3386

3389 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),

3390 errmsg("type %s does not support subscripted assignment",

3392

3393

3394

3395

3396

3397

3398

3399

3400

3401

3402

3403

3404

3405

3406

3408 {

3411 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),

3412 errmsg("type %s does not support subscripted assignment",

3418 }

3419

3420

3421 save_innermost_caseval = state->innermost_caseval;

3422 save_innermost_casenull = state->innermost_casenull;

3424 state->innermost_casenull = &sbsrefstate->prevnull;

3425

3426

3429

3430 state->innermost_caseval = save_innermost_caseval;

3431 state->innermost_casenull = save_innermost_casenull;

3432

3433

3438 }

3439 else

3440 {

3441

3446 }

3447

3448

3449 foreach(lc, adjust_jumps)

3450 {

3452

3454 {

3457 }

3458 else

3459 {

3463 }

3464 }

3465}

3466

3467

3468

3469

3470

3471

3472

3473

3474

3475

3476

3477

3478

3479

3480

3481

3482

3483

3484static bool

3486{

3487 if (expr == NULL)

3488 return false;

3490 {

3492

3494 return true;

3495 }

3497 {

3499

3501 return true;

3502 }

3504 {

3506

3508 }

3510 {

3512

3514 }

3515 return false;

3516}

3517

3518

3519

3520

3521static void

3524{

3526 Datum *domainval = NULL;

3527 bool *domainnull = NULL;

3529

3531

3535

3536

3537

3538

3539

3540

3542

3543

3544

3545

3546

3547

3548

3549

3550

3551

3552

3553

3554

3555

3556

3557

3558

3559

3563 constraint_ref,

3565 false);

3566

3567

3568

3569

3570

3571

3573 {

3575 Datum *save_innermost_domainval;

3576 bool *save_innermost_domainnull;

3577

3579

3581 {

3585 break;

3587

3589 {

3593 (bool *) palloc(sizeof(bool));

3594 }

3595

3596

3597

3598

3599

3600 if (domainval == NULL)

3601 {

3602

3603

3604

3605

3607 {

3609

3610

3612 domainnull = (bool *) palloc(sizeof(bool));

3613

3614

3616 scratch2.resvalue = domainval;

3617 scratch2.resnull = domainnull;

3621 }

3622 else

3623 {

3624

3625 domainval = resv;

3626 domainnull = resnull;

3627 }

3628 }

3629

3630

3631

3632

3633

3634

3635

3636 save_innermost_domainval = state->innermost_domainval;

3637 save_innermost_domainnull = state->innermost_domainnull;

3638 state->innermost_domainval = domainval;

3639 state->innermost_domainnull = domainnull;

3640

3641

3645

3646 state->innermost_domainval = save_innermost_domainval;

3647 state->innermost_domainnull = save_innermost_domainnull;

3648

3649

3652

3653 break;

3654 default:

3655 elog(ERROR, "unrecognized constraint type: %d",

3657 break;

3658 }

3659 }

3660}

3661

3662

3663

3664

3665

3666

3667

3668

3669

3670

3671

3672

3673

3674

3675

3678 bool doSort, bool doHash, bool nullcheck)

3679{

3685

3686 state->expr = (Expr *) aggstate;

3687 state->parent = parent;

3688

3691

3692

3693

3694

3695

3696 for (int transno = 0; transno < aggstate->numtrans; transno++)

3697 {

3699

3701 &deform);

3703 &deform);

3705 &deform);

3707 &deform);

3709 &deform);

3710 }

3712

3713

3714

3715

3716 for (int transno = 0; transno < aggstate->numtrans; transno++)

3717 {

3720 List *adjust_bailout = NIL;

3722 bool *strictnulls = NULL;

3723 int argno;

3725

3726

3727

3728

3729

3730

3731

3733 {

3734

3737

3739 scratch.d.jump.jumpdone = -1;

3741 adjust_bailout = lappend_int(adjust_bailout,

3742 state->steps_len - 1);

3743 }

3744

3745

3746

3747

3748 argno = 0;

3749 if (isCombine)

3750 {

3751

3752

3753

3754

3755

3757

3760

3761 strictargs = trans_fcinfo->args + 1;

3763

3764

3765

3766

3767

3769 {

3770

3771

3772

3773

3775 &trans_fcinfo->args[argno + 1].value,

3776 &trans_fcinfo->args[argno + 1].isnull);

3777 }

3778 else

3779 {

3781

3782

3786

3787

3790

3791

3792

3793

3794

3797 else

3799

3804

3806

3808 adjust_bailout = lappend_int(adjust_bailout,

3809 state->steps_len - 1);

3810

3811

3814 }

3815 argno++;

3816

3818 }

3820 {

3822

3823

3824

3825

3826

3827

3828 strictargs = trans_fcinfo->args + 1;

3829

3831 {

3833

3834

3835

3836

3837

3839 break;

3840

3841

3842

3843

3844

3846 &trans_fcinfo->args[argno + 1].value,

3847 &trans_fcinfo->args[argno + 1].isnull);

3848 argno++;

3849 }

3851 }

3852 else if (pertrans->numInputs == 1)

3853 {

3854

3855

3856

3857

3860

3862

3864 &state->resvalue,

3865 &state->resnull);

3866 strictnulls = &state->resnull;

3867 argno++;

3868

3870 }

3871 else

3872 {

3873

3874

3875

3876

3880

3881 strictnulls = nulls;

3882

3884 {

3886

3888 &values[argno], &nulls[argno]);

3889 argno++;

3890 }

3892 }

3893

3894

3895

3896

3897

3898

3900 {

3901 if (strictnulls)

3903 else if (strictargs && pertrans->numTransInputs == 1)

3905 else

3912 adjust_bailout = lappend_int(adjust_bailout,

3913 state->steps_len - 1);

3914 }

3915

3916

3918 {

3921 else

3923

3927 adjust_bailout = lappend_int(adjust_bailout,

3928 state->steps_len - 1);

3929 }

3930

3931

3932

3933

3934

3935

3936 if (doSort)

3937 {

3938 int processGroupingSets = Max(phase->numsets, 1);

3939 int setoff = 0;

3940

3941 for (int setno = 0; setno < processGroupingSets; setno++)

3942 {

3944 pertrans, transno, setno, setoff, false,

3945 nullcheck);

3946 setoff++;

3947 }

3948 }

3949

3950 if (doHash)

3951 {

3952 int numHashes = aggstate->num_hashes;

3953 int setoff;

3954

3955

3957 setoff = aggstate->maxsets;

3958 else

3959 setoff = 0;

3960

3961 for (int setno = 0; setno < numHashes; setno++)

3962 {

3964 pertrans, transno, setno, setoff, true,

3965 nullcheck);

3966 setoff++;

3967 }

3968 }

3969

3970

3971 foreach(bail, adjust_bailout)

3972 {

3974

3976 {

3979 }

3983 {

3986 }

3988 {

3991 }

3994 {

3997 }

3998 else

4000 }

4001 }

4002

4007

4009

4011}

4012

4013

4014

4015

4016

4017

4018static void

4022 int transno, int setno, int setoff, bool ishash,

4023 bool nullcheck)

4024{

4026 int adjust_jumpnull = -1;

4027

4028 if (ishash)

4030 else

4031 aggcontext = aggstate->aggcontexts[setno];

4032

4033

4034 if (nullcheck)

4035 {

4038

4041 adjust_jumpnull = state->steps_len - 1;

4042 }

4043

4044

4045

4046

4047

4048

4049

4050

4051

4052

4053

4054

4055

4056

4057

4058

4059

4060

4061

4062

4063

4064

4065

4066

4067

4068

4069

4070

4071

4072

4073

4074

4075

4076

4077

4079 {

4081 {

4087 else

4089 }

4090 else

4091 {

4097 else

4099 }

4100 }

4101 else if (pertrans->numInputs == 1)

4103 else

4105

4112

4113

4114 if (adjust_jumpnull != -1)

4115 {

4117

4121 }

4122}

4123

4124

4125

4126

4127

4128

4129

4130

4131

4132

4133

4134

4135

4136

4137

4138

4139

4142 FmgrInfo *hashfunctions, Oid *collations,

4145{

4149 intptr_t opcode;

4151

4152 Assert(numCols >= 0);

4153

4154 state->parent = parent;

4155

4156

4157

4158

4159

4160

4161 if ((int64) numCols + (init_value != 0) > 1)

4163

4164

4165 for (int i = 0; i < numCols; i++)

4166 last_attnum = Max(last_attnum, keyColIdx[i]);

4167

4175

4176 if (init_value == 0)

4177 {

4178

4179

4180

4181

4182

4184 }

4185 else

4186 {

4187

4188

4189

4190

4191

4194 scratch.resvalue = numCols > 0 ? &iresult->value : &state->resvalue;

4196

4198

4199

4200

4201

4202

4204 }

4205

4206 for (int i = 0; i < numCols; i++)

4207 {

4210 Oid inputcollid = collations[i];

4212

4213 finfo = &hashfunctions[i];

4215

4216

4218

4219

4220

4221

4222

4229

4231

4232

4233 scratch.opcode = opcode;

4234

4235 if (i == numCols - 1)

4236 {

4237

4238

4239

4240

4243 }

4244 else

4245 {

4246 Assert(iresult != NULL);

4247

4248

4251 }

4252

4253

4254

4255

4256

4258

4263

4265

4266

4268 }

4269

4274

4276

4278}

4279

4280

4281

4282

4283

4284

4285

4286

4287

4288

4289

4290

4291

4292

4293

4294

4295

4296

4297

4298

4301 const Oid *hashfunc_oids, const List *collations,

4302 const List *hash_exprs, const bool *opstrict,

4304{

4308 List *adjust_jumps = NIL;

4311 intptr_t strict_opcode;

4312 intptr_t opcode;

4313 int num_exprs = list_length(hash_exprs);

4314

4316

4317 state->parent = parent;

4318

4319

4321

4322

4323

4324

4325

4326

4327 if ((int64) num_exprs + (init_value != 0) > 1)

4329

4330 if (init_value == 0)

4331 {

4332

4333

4334

4335

4336

4339 }

4340 else

4341 {

4342

4343

4344

4345

4346

4349 scratch.resvalue = num_exprs > 0 ? &iresult->value : &state->resvalue;

4350 scratch.resnull = num_exprs > 0 ? &iresult->isnull : &state->resnull;

4351

4353

4354

4355

4356

4357

4360 }

4361

4362 forboth(lc, hash_exprs, lc2, collations)

4363 {

4368 Oid funcid;

4370

4371 funcid = hashfunc_oids[i];

4372

4373

4376

4378

4379

4380

4381

4382

4387

4388 if (i == num_exprs - 1)

4389 {

4390

4393 }

4394 else

4395 {

4396 Assert(iresult != NULL);

4397

4398

4401 }

4402

4403

4404

4405

4406

4408

4409

4411

4415

4416 scratch.opcode = opstrict[i] && !keep_nulls ? strict_opcode : opcode;

4418

4420 adjust_jumps = lappend_int(adjust_jumps, state->steps_len - 1);

4421

4422

4423

4424

4425

4428 }

4429

4430

4431 foreach(lc, adjust_jumps)

4432 {

4434

4441 }

4442

4447

4449

4451}

4452

4453

4454

4455

4456

4457

4458

4459

4460

4461

4462

4463

4467 int numCols,

4469 const Oid *eqfunctions,

4470 const Oid *collations,

4472{

4475 int maxatt = -1;

4476 List *adjust_jumps = NIL;

4478

4479

4480

4481

4482

4483 if (numCols == 0)

4484 return NULL;

4485

4486 state->expr = NULL;

4488 state->parent = parent;

4489

4492

4493

4494 for (int natt = 0; natt < numCols; natt++)

4495 {

4496 int attno = keyColIdx[natt];

4497

4498 if (attno > maxatt)

4499 maxatt = attno;

4500 }

4501 Assert(maxatt >= 0);

4502

4503

4511

4519

4520

4521

4522

4523

4524 for (int natt = numCols; --natt >= 0;)

4525 {

4526 int attno = keyColIdx[natt];

4529 Oid foid = eqfunctions[natt];

4534

4535

4539

4541

4542

4548 collid, NULL, NULL);

4549

4550

4558

4559

4567

4568

4577

4578

4584 adjust_jumps = lappend_int(adjust_jumps,

4585 state->steps_len - 1);

4586 }

4587

4588

4589 foreach(lc, adjust_jumps)

4590 {

4592

4596 }

4597

4602

4604

4606}

4607

4608

4609

4610

4611

4612

4613

4614

4615

4616

4617

4618

4619

4620

4621

4622

4627 const Oid *eqfunctions,

4628 const Oid *collations,

4629 const List *param_exprs,

4631{

4635 List *adjust_jumps = NIL;

4637

4638 state->expr = NULL;

4640 state->parent = parent;

4641

4644

4645

4653

4661

4662 for (int attno = 0; attno < maxatt; attno++)

4663 {

4665 Oid foid = eqfunctions[attno];

4670

4671

4675

4677

4678

4684 collid, NULL, NULL);

4685

4686

4694

4695

4703

4704

4713

4714

4720 adjust_jumps = lappend_int(adjust_jumps,

4721 state->steps_len - 1);

4722 }

4723

4724

4725 foreach(lc, adjust_jumps)

4726 {

4728

4732 }

4733

4738

4740

4742}

4743

4744

4745

4746

4747static void

4749 Datum *resv, bool *resnull,

4751{

4755 List *jumps_return_null = NIL;

4756 List *jumps_to_end = NIL;

4759 bool returning_domain =

4761

4763

4764 jsestate->jsexpr = jsexpr;

4765

4766

4767

4768

4769

4773

4774

4775 jumps_return_null = lappend_int(jumps_return_null, state->steps_len);

4780

4781

4782

4783

4784

4788

4789

4790 jumps_return_null = lappend_int(jumps_return_null, state->steps_len);

4795

4796

4800 {

4804

4809

4811

4813 }

4814

4815

4818 scratch->resnull = resnull;

4821

4822

4823

4824

4825

4826

4827 foreach(lc, jumps_return_null)

4828 {

4830

4832 }

4835 scratch->resnull = resnull;

4839

4842

4843

4844

4845

4846

4847

4849

4850

4851

4852

4853

4856 {

4858

4862 resv, resnull);

4863 }

4865 {

4866

4867

4868

4869

4870

4871 Oid typinput;

4872 Oid typioparam;

4875

4882

4883

4884

4885

4886

4892

4894 }

4895

4896

4897

4898

4899

4900

4902 {

4906 }

4907

4909

4910

4911

4912

4913

4914

4915

4916

4917

4918

4919

4920

4921

4925 returning_domain))

4926 {

4928

4930

4931

4938

4939

4940

4941

4942

4943 saved_escontext = state->escontext;

4944 state->escontext = escontext;

4946 state, resv, resnull);

4947 state->escontext = saved_escontext;

4948

4949

4953 resv, resnull);

4954

4955

4956

4957

4958

4962 {

4965 scratch->resnull = resnull;

4968 }

4969

4970

4975 }

4976

4977

4978

4979

4980

4981

4982

4983

4984 if (jsexpr->on_empty != NULL &&

4988 returning_domain))

4989 {

4991

4993

4994

5001

5002

5003

5004

5005

5006 saved_escontext = state->escontext;

5007 state->escontext = escontext;

5009 state, resv, resnull);

5010 state->escontext = saved_escontext;

5011

5012

5016 resv, resnull);

5017

5018

5019

5020

5021

5025 {

5026

5029 scratch->resnull = resnull;

5032 }

5033 }

5034

5035 foreach(lc, jumps_to_end)

5036 {

5038

5040 }

5041

5043}

5044

5045

5046

5047

5048

5049static void

5052 bool exists_coerce,

5053 Datum *resv, bool *resnull)

5054{

5056

5057

5060 scratch.resnull = resnull;

5072}

void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)

AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)

#define InvalidAttrNumber

bool bms_is_member(int x, const Bitmapset *a)

Bitmapset * bms_add_member(Bitmapset *a, int x)

static Datum values[MAXATTR]

#define OidIsValid(objectId)

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

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

int errcode(int sqlerrcode)

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

#define ereport(elevel,...)

void ExecReadyInterpretedExpr(ExprState *state)

static void ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest, ExprState *state, Datum *resv, bool *resnull)

static void ExecInitSubPlanExpr(SubPlan *subplan, ExprState *state, Datum *resv, bool *resnull)

ExprState * ExecBuildHash32FromAttrs(TupleDesc desc, const TupleTableSlotOps *ops, FmgrInfo *hashfunctions, Oid *collations, int numCols, AttrNumber *keyColIdx, PlanState *parent, uint32 init_value)

ExprState * ExecInitExpr(Expr *node, PlanState *parent)

ExprState * ExecPrepareExpr(Expr *node, EState *estate)

bool ExecCheck(ExprState *state, ExprContext *econtext)

ExprState * ExecInitCheck(List *qual, PlanState *parent)

static void ExecPushExprSetupSteps(ExprState *state, ExprSetupInfo *info)

static void ExecInitExprRec(Expr *node, ExprState *state, Datum *resv, bool *resnull)

static void ExecBuildAggTransCall(ExprState *state, AggState *aggstate, ExprEvalStep *scratch, FunctionCallInfo fcinfo, AggStatePerTrans pertrans, int transno, int setno, int setoff, bool ishash, bool nullcheck)

static void ExecInitWholeRowVar(ExprEvalStep *scratch, Var *variable, ExprState *state)

void ExprEvalPushStep(ExprState *es, const ExprEvalStep *s)

ProjectionInfo * ExecBuildProjectionInfo(List *targetList, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent, TupleDesc inputDesc)

struct ExprSetupInfo ExprSetupInfo

static bool isAssignmentIndirectionExpr(Expr *expr)

static void ExecInitSubscriptingRef(ExprEvalStep *scratch, SubscriptingRef *sbsref, ExprState *state, Datum *resv, bool *resnull)

ExprState * ExecPrepareQual(List *qual, EState *estate)

ExprState * ExecInitQual(List *qual, PlanState *parent)

static bool expr_setup_walker(Node *node, ExprSetupInfo *info)

static void ExecInitJsonCoercion(ExprState *state, JsonReturning *returning, ErrorSaveContext *escontext, bool omit_quotes, bool exists_coerce, Datum *resv, bool *resnull)

List * ExecInitExprList(List *nodes, PlanState *parent)

ExprState * ExecInitExprWithParams(Expr *node, ParamListInfo ext_params)

ProjectionInfo * ExecBuildUpdateProjection(List *targetList, bool evalTargetList, List *targetColnos, TupleDesc relDesc, ExprContext *econtext, TupleTableSlot *slot, PlanState *parent)

ExprState * ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, const TupleTableSlotOps *lops, const TupleTableSlotOps *rops, int numCols, const AttrNumber *keyColIdx, const Oid *eqfunctions, const Oid *collations, PlanState *parent)

static bool ExecComputeSlotInfo(ExprState *state, ExprEvalStep *op)

ExprState * ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase, bool doSort, bool doHash, bool nullcheck)

static void ExecInitFunc(ExprEvalStep *scratch, Expr *node, List *args, Oid funcid, Oid inputcollid, ExprState *state)

static void ExecCreateExprSetupSteps(ExprState *state, Node *node)

List * ExecPrepareExprList(List *nodes, EState *estate)

static void ExecReadyExpr(ExprState *state)

static void ExecInitJsonExpr(JsonExpr *jsexpr, ExprState *state, Datum *resv, bool *resnull, ExprEvalStep *scratch)

ExprState * ExecBuildParamSetEqual(TupleDesc desc, const TupleTableSlotOps *lops, const TupleTableSlotOps *rops, const Oid *eqfunctions, const Oid *collations, const List *param_exprs, PlanState *parent)

ExprState * ExecBuildHash32Expr(TupleDesc desc, const TupleTableSlotOps *ops, const Oid *hashfunc_oids, const List *collations, const List *hash_exprs, const bool *opstrict, PlanState *parent, uint32 init_value, bool keep_nulls)

ExprState * ExecPrepareCheck(List *qual, EState *estate)

@ 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

JunkFilter * ExecInitJunkFilter(List *targetList, TupleTableSlot *slot)

TupleDesc BlessTupleDesc(TupleDesc tupdesc)

const TupleTableSlotOps TTSOpsVirtual

void ExecTypeSetColNames(TupleDesc typeInfo, List *namesList)

TupleTableSlot * ExecInitExtraTupleSlot(EState *estate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)

TupleDesc ExecTypeFromExprList(List *exprList)

TupleDesc ExecGetResultType(PlanState *planstate)

int executor_errposition(EState *estate, int location)

const TupleTableSlotOps * ExecGetResultSlotOps(PlanState *planstate, bool *isfixed)

#define outerPlanState(node)

#define EEO_FLAG_NEW_IS_NULL

#define innerPlanState(node)

#define EEO_FLAG_OLD_IS_NULL

static Datum ExecEvalExprSwitchContext(ExprState *state, ExprContext *econtext, bool *isNull)

void fmgr_info(Oid functionId, FmgrInfo *finfo)

#define SizeForFunctionCallInfo(nargs)

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

#define fmgr_info_set_expr(expr, finfo)

char * format_type_be(Oid type_oid)

Assert(PointerIsAligned(start, uint64))

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

bool jit_compile_expr(struct ExprState *state)

void json_categorize_type(Oid typoid, bool is_jsonb, JsonTypeCategory *tcategory, Oid *outfuncoid)

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

List * lappend_int(List *list, int datum)

void get_op_opfamily_properties(Oid opno, Oid opfamily, bool ordering_op, int *strategy, Oid *lefttype, Oid *righttype)

Oid get_element_type(Oid typid)

void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)

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

Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)

void getTypeInputInfo(Oid type, Oid *typInput, Oid *typIOParam)

const struct SubscriptRoutines * getSubscriptingRoutines(Oid typid, Oid *typelemp)

char * get_func_name(Oid funcid)

int16 get_typlen(Oid typid)

char get_typtype(Oid typid)

Oid getBaseType(Oid typid)

Expr * make_ands_explicit(List *andclauses)

Const * makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid)

void * repalloc(void *pointer, Size size)

void * palloc0(Size size)

MemoryContext CurrentMemoryContext

Oid exprType(const Node *expr)

int32 exprTypmod(const Node *expr)

int exprLocation(const Node *expr)

#define expression_tree_walker(n, w, c)

SubPlanState * ExecInitSubPlan(SubPlan *subplan, PlanState *parent)

#define IsA(nodeptr, _type_)

#define DO_AGGSPLIT_COMBINE(as)

#define castNode(_type_, nodeptr)

#define InvokeFunctionExecuteHook(objectId)

static MemoryContext MemoryContextSwitchTo(MemoryContext context)

FormData_pg_attribute * Form_pg_attribute

#define lfirst_node(type, lc)

static int list_length(const List *l)

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

#define foreach_current_index(var_or_cell)

#define foreach_ptr(type, var, lst)

#define forfive(cell1, list1, cell2, list2, cell3, list3, cell4, list4, cell5, list5)

#define foreach_int(var, lst)

Expr * expression_planner(Expr *expr)

static bool DatumGetBool(Datum X)

static Datum PointerGetDatum(const void *X)

static Datum ObjectIdGetDatum(Oid X)

static Datum Int32GetDatum(int32 X)

static Datum UInt32GetDatum(uint32 X)

void check_stack_depth(void)

TupleTableSlot * sortslot

FunctionCallInfo deserialfn_fcinfo

FunctionCallInfo transfn_fcinfo

AggStatePerTrans pertrans

ExprContext * hashcontext

ExprContext ** aggcontexts

BoolTestType booltesttype

DomainConstraintType constrainttype

MemoryContext es_query_cxt

ExprState * elemexprstate

struct ExprEvalStep::@55::@94 grouping_func

struct ExprEvalStep::@55::@66 jump

WindowFuncExprState * wfstate

void * json_coercion_cache

ExecEvalBoolSubroutine subscriptfunc

struct ExprEvalStep::@55::@81 fieldselect

struct ExprEvalStep::@55::@90 hashedscalararrayop

struct ExprEvalStep::@55::@92 json_constructor

struct ExprEvalStep::@55::@60 assign_tmp

struct ExprEvalStep::@55::@71 make_readonly

struct ExprEvalStep::@55::@57 var

struct ExprEvalStep::@55::@82 fieldstore

struct ExprEvalStep::@55::@85 domaincheck

struct ExprEvalStep::@55::@102 is_json

struct SubscriptingRefState * state

VarReturningType varreturningtype

AggStatePerTrans pertrans

struct ExprEvalStep::@55::@104 jsonexpr_coercion

struct ExprEvalStep::@55::@78 rowcompare_step

struct ExprEvalStep::@55::@83 sbsref_subscript

struct JsonExprState * jsestate

struct ExprEvalStep::@55::@91 xmlexpr

struct ExprEvalStep::@55::@84 sbsref

struct ExprEvalStep::@55::@67 nulltest_row

FunctionCallInfo fcinfo_data_in

struct ExprEvalStep::@55::@77 row

ExprEvalRowtypeCache * incache

struct ExprEvalStep::@55::@103 jsonexpr

struct ExprEvalStep::@55::@74 nextvalueexpr

struct ExprEvalStep::@55::@86 hashdatum_initvalue

const TupleTableSlotOps * kind

struct ExprEvalStep::@55::@99 agg_plain_pergroup_nullcheck

struct ExprEvalStep::@55::@62 constval

FunctionCallInfo fcinfo_data

struct ExprEvalStep::@55::@93 aggref

struct ExprEvalStep::@55::@97 agg_deserialize

struct ExprEvalStep::@55::@95 window_func

struct ExprEvalStep::@55::@61 returningexpr

struct ExprEvalStep::@55::@72 iocoerce

ErrorSaveContext * escontext

union ExprEvalStep::@55 d

struct ExprEvalStep::@55::@98 agg_strict_input_check

struct ExprEvalStep::@55::@80 minmax

struct ExprEvalStep::@55::@88 convert_rowtype

struct ExprEvalStep::@55::@79 rowcompare_final

struct ExprEvalStep::@55::@70 casetest

struct ExprEvalStep::@55::@75 arrayexpr

struct ExprEvalStep::@55::@89 scalararrayop

struct ExprEvalStep::@55::@100 agg_presorted_distinctcheck

struct ExprEvalStep::@55::@65 qualexpr

struct ExprEvalStep::@55::@58 wholerow

struct ExprEvalStep::@55::@101 agg_trans

FunctionCallInfo fcinfo_data_out

ExprEvalRowtypeCache * outcache

struct ExprEvalStep::@55::@68 param

struct ExprEvalStep::@55::@87 hashdatum

struct ExprEvalStep::@55::@96 subplan

struct ExprEvalStep::@55::@63 func

struct ExprEvalStep::@55::@73 sqlvaluefunction

struct ExprEvalStep::@55::@64 boolexpr

ExprEvalRowtypeCache rowcache

struct JsonConstructorExprState * jcstate

struct ExprEvalStep::@55::@56 fetch

struct ExprEvalStep::@55::@59 assign_var

struct ArrayMapState * amstate

struct ExprEvalStep::@55::@76 arraycoerce

List * multiexpr_subplans

struct ExprEvalStep * steps

struct PlanState * parent

bool * innermost_casenull

Datum * innermost_caseval

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

NullTestType nulltesttype

ParamCompileHook paramCompile

const TupleTableSlotOps * outerops

const TupleTableSlotOps * innerops

const TupleTableSlotOps * scanops

ExprContext * pi_exprContext

ExecEvalSubroutine sbs_fetch_old

ExecEvalBoolSubroutine sbs_check_subscripts

ExecEvalSubroutine sbs_assign

ExecEvalSubroutine sbs_fetch

SubscriptExecSetup exec_setup

#define ReleaseTupleDesc(tupdesc)

static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)

static CompactAttribute * TupleDescCompactAttr(TupleDesc tupdesc, int i)

void InitDomainConstraintRef(Oid type_id, DomainConstraintRef *ref, MemoryContext refctx, bool need_exprstate)

TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod)

bool DomainHasConstraints(Oid type_id)

TupleDesc lookup_rowtype_tupdesc_copy(Oid type_id, int32 typmod)

TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)

#define TYPECACHE_CMP_PROC

static void convert(const int32 val, char *const buf)