- Notifications
You must be signed in to change notification settings - Fork28
Commit0f0deb7
committed
Improve predtest.c's handling of cases with NULL-constant inputs.
Currently, if operator_predicate_proof() is given an operator clause like"something op NULL", it just throws up its hands and reports it can't proveanything. But we can often do better than that, if the operator is strict,because then we know that the clause returns NULL overall. Depending onwhether we're trying to prove or refute something, and whether we needweak or strong semantics for NULL, this may be enough to prove theimplication, especially when we rely on the standard rule that "falseimplies anything". In particular, this lets us do something useful withquestions like "does X IN (1,3,5,NULL) imply X <= 5?" The null entryin the IN list can effectively be ignored for this purpose, but theproof rules were not previously smart enough to deduce that.This patch is by me, but it owes something to previous work byAmit Langote to try to solve problems of the form mentioned.Thanks also to Emre Hasegeli and Ashutosh Bapat for review.Discussion:https://postgr.es/m/3bad48fc-f257-c445-feeb-8a2b2fb622ba@lab.ntt.co.jp1 parent27ba260 commit0f0deb7
File tree
4 files changed
+46
-23
lines changed- src
- backend/optimizer/util
- test
- modules/test_predtest
- expected
- sql
- regress/expected
4 files changed
+46
-23
lines changedLines changed: 44 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
100 | 100 |
| |
101 | 101 |
| |
102 | 102 |
| |
103 |
| - | |
| 103 | + | |
104 | 104 |
| |
105 | 105 |
| |
106 | 106 |
| |
| |||
1137 | 1137 |
| |
1138 | 1138 |
| |
1139 | 1139 |
| |
1140 |
| - | |
| 1140 | + | |
1141 | 1141 |
| |
1142 | 1142 |
| |
1143 | 1143 |
| |
| |||
1232 | 1232 |
| |
1233 | 1233 |
| |
1234 | 1234 |
| |
1235 |
| - | |
| 1235 | + | |
1236 | 1236 |
| |
1237 | 1237 |
| |
1238 | 1238 |
| |
| |||
1498 | 1498 |
| |
1499 | 1499 |
| |
1500 | 1500 |
| |
1501 |
| - | |
1502 |
| - | |
1503 |
| - | |
| 1501 | + | |
| 1502 | + | |
1504 | 1503 |
| |
1505 | 1504 |
| |
1506 | 1505 |
| |
| |||
1528 | 1527 |
| |
1529 | 1528 |
| |
1530 | 1529 |
| |
1531 |
| - | |
| 1530 | + | |
| 1531 | + | |
1532 | 1532 |
| |
1533 | 1533 |
| |
1534 | 1534 |
| |
| |||
1675 | 1675 |
| |
1676 | 1676 |
| |
1677 | 1677 |
| |
1678 |
| - | |
1679 |
| - | |
1680 |
| - | |
1681 |
| - | |
1682 |
| - | |
1683 |
| - | |
| 1678 | + | |
| 1679 | + | |
1684 | 1680 |
| |
1685 |
| - | |
1686 |
| - | |
1687 | 1681 |
| |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
1688 | 1716 |
| |
| 1717 | + | |
1689 | 1718 |
| |
1690 | 1719 |
| |
1691 | 1720 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
781 | 781 |
| |
782 | 782 |
| |
783 | 783 |
| |
784 |
| - | |
785 | 784 |
| |
786 | 785 |
| |
787 | 786 |
| |
788 | 787 |
| |
789 | 788 |
| |
790 |
| - | |
| 789 | + | |
791 | 790 |
| |
792 | 791 |
| |
793 | 792 |
| |
|
Lines changed: 0 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
306 | 306 |
| |
307 | 307 |
| |
308 | 308 |
| |
309 |
| - | |
310 | 309 |
| |
311 | 310 |
| |
312 | 311 |
| |
|
Lines changed: 1 addition & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1739 | 1739 |
| |
1740 | 1740 |
| |
1741 | 1741 |
| |
1742 |
| - | |
1743 |
| - | |
1744 |
| - | |
1745 |
| - | |
1746 |
| - | |
| 1742 | + | |
1747 | 1743 |
| |
1748 | 1744 |
| |
1749 | 1745 |
| |
|
0 commit comments
Comments
(0)