forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb2d0e13
committed
Fix over-optimistic updating of info about commutable outer joins.
make_outerjoininfo was set up to update SpecialJoinInfo'scommute_below, commute_above_l, commute_above_r fields as soon asit found a pair of outer joins that look like they can commute.However, this decision could be negated later in the same loop dueto finding an intermediate outer join that prevents commutation.That left us with commute_xxx fields that were contradictory to thejoin order restrictions expressed in min_lefthand/min_righthand.The latter fields would keep us from actually choosing a bad joinorder; but the inconsistent commute_xxx fields could bollix detailssuch as the varnullingrels values created for intermediate joinrelation targetlists, ending in an assertion failure in setrefs.c.To fix, wait till the end of make_outerjoininfo where we haveaccurate values for min_lefthand/min_righthand, and then insertonly relids not present in those sets into the commute_xxx fields.Per SQLSmith testing by Robins Tharakan. Note that while Robinsbisected the failure to commitb448f1c, it's really the fault of2489d76. The outerjoin_delayed logic removed in the later commitwas keeping us from deciding that troublesome join pairs commute,at least in the specific example seen here.Discussion:https://postgr.es/m/CAEP4nAyAORgE8K_RHSmvWbE9UaChhjbEL1RrDU3neePwwRUB=A@mail.gmail.com1 parent9f452fe commitb2d0e13
File tree
3 files changed
+99
-16
lines changed- src
- backend/optimizer/plan
- test/regress
- expected
- sql
3 files changed
+99
-16
lines changedLines changed: 58 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1358 | 1358 |
| |
1359 | 1359 |
| |
1360 | 1360 |
| |
| 1361 | + | |
| 1362 | + | |
1361 | 1363 |
| |
1362 | 1364 |
| |
1363 | 1365 |
| |
| |||
1445 | 1447 |
| |
1446 | 1448 |
| |
1447 | 1449 |
| |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
1448 | 1456 |
| |
| 1457 | + | |
1449 | 1458 |
| |
1450 | 1459 |
| |
1451 | 1460 |
| |
| |||
1458 | 1467 |
| |
1459 | 1468 |
| |
1460 | 1469 |
| |
| 1470 | + | |
1461 | 1471 |
| |
1462 | 1472 |
| |
1463 | 1473 |
| |
1464 | 1474 |
| |
1465 | 1475 |
| |
1466 | 1476 |
| |
1467 | 1477 |
| |
1468 |
| - | |
1469 |
| - | |
1470 |
| - | |
| 1478 | + | |
| 1479 | + | |
1471 | 1480 |
| |
1472 | 1481 |
| |
1473 | 1482 |
| |
| |||
1476 | 1485 |
| |
1477 | 1486 |
| |
1478 | 1487 |
| |
1479 |
| - | |
1480 |
| - | |
1481 |
| - | |
| 1488 | + | |
| 1489 | + | |
1482 | 1490 |
| |
1483 | 1491 |
| |
1484 | 1492 |
| |
| |||
1536 | 1544 |
| |
1537 | 1545 |
| |
1538 | 1546 |
| |
1539 |
| - | |
1540 |
| - | |
1541 |
| - | |
1542 |
| - | |
1543 |
| - | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
1544 | 1550 |
| |
1545 | 1551 |
| |
1546 | 1552 |
| |
| |||
1589 | 1595 |
| |
1590 | 1596 |
| |
1591 | 1597 |
| |
1592 |
| - | |
1593 |
| - | |
1594 |
| - | |
1595 |
| - | |
1596 |
| - | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
1597 | 1601 |
| |
1598 | 1602 |
| |
1599 | 1603 |
| |
| |||
1639 | 1643 |
| |
1640 | 1644 |
| |
1641 | 1645 |
| |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
1642 | 1684 |
| |
1643 | 1685 |
| |
1644 | 1686 |
| |
|
Lines changed: 30 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4469 | 4469 |
| |
4470 | 4470 |
| |
4471 | 4471 |
| |
| 4472 | + | |
| 4473 | + | |
| 4474 | + | |
| 4475 | + | |
| 4476 | + | |
| 4477 | + | |
| 4478 | + | |
| 4479 | + | |
| 4480 | + | |
| 4481 | + | |
| 4482 | + | |
| 4483 | + | |
| 4484 | + | |
| 4485 | + | |
| 4486 | + | |
| 4487 | + | |
| 4488 | + | |
| 4489 | + | |
| 4490 | + | |
| 4491 | + | |
| 4492 | + | |
| 4493 | + | |
| 4494 | + | |
| 4495 | + | |
| 4496 | + | |
| 4497 | + | |
| 4498 | + | |
| 4499 | + | |
| 4500 | + | |
| 4501 | + | |
4472 | 4502 |
| |
4473 | 4503 |
| |
4474 | 4504 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1545 | 1545 |
| |
1546 | 1546 |
| |
1547 | 1547 |
| |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
1548 | 1559 |
| |
1549 | 1560 |
| |
1550 | 1561 |
| |
|
0 commit comments
Comments
(0)