- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit5ef34a8
committed
Fix the issue that SJE mistakenly omits qual clauses
When the SJE code handles the transfer of qual clauses from the removedrelation to the remaining one, it replaces the Vars of the removedrelation with the Vars of the remaining relation for each clause, andthen reintegrates these clauses into the appropriate restriction or joinclause lists, while attempting to avoid duplicates.However, the code compares RestrictInfo->clause to determine if twoclauses are duplicates. This is just flat wrong. Two RestrictInfoswith the same clause can have different required_relids,incompatible_relids, is_pushed_down, and so on. This can cause qualclauses to be mistakenly omitted, leading to wrong results.This patch fixes it by comparing the entire RestrictInfos not just theirclauses ignoring 'rinfo_serial' field (otherwise almost all RestrictInfos willbe unique). Making 'rinfo_serial' equal_ignore would break other code. Thisis why this commit implements our own comparison function for checking theequality of RestrictInfos.Reported-by: Zuming JiangBug: #18261Discussion:https://postgr.es/m/18261-2a75d748c928609b%40postgresql.orgAuthor: Richard Guo1 parent43b46aa commit5ef34a8
File tree
3 files changed
+65
-4
lines changed- src
- backend/optimizer/plan
- test/regress
- expected
- sql
3 files changed
+65
-4
lines changedLines changed: 24 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1657 | 1657 |
| |
1658 | 1658 |
| |
1659 | 1659 |
| |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
1660 | 1682 |
| |
1661 | 1683 |
| |
1662 | 1684 |
| |
| |||
1760 | 1782 |
| |
1761 | 1783 |
| |
1762 | 1784 |
| |
1763 |
| - | |
| 1785 | + | |
1764 | 1786 |
| |
1765 | 1787 |
| |
1766 | 1788 |
| |
| |||
1788 | 1810 |
| |
1789 | 1811 |
| |
1790 | 1812 |
| |
1791 |
| - | |
| 1813 | + | |
1792 | 1814 |
| |
1793 | 1815 |
| |
1794 | 1816 |
| |
|
Lines changed: 25 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6742 | 6742 |
| |
6743 | 6743 |
| |
6744 | 6744 |
| |
6745 |
| - | |
| 6745 | + | |
6746 | 6746 |
| |
6747 | 6747 |
| |
6748 | 6748 |
| |
| |||
6880 | 6880 |
| |
6881 | 6881 |
| |
6882 | 6882 |
| |
| 6883 | + | |
| 6884 | + | |
| 6885 | + | |
| 6886 | + | |
| 6887 | + | |
| 6888 | + | |
| 6889 | + | |
| 6890 | + | |
| 6891 | + | |
| 6892 | + | |
| 6893 | + | |
| 6894 | + | |
| 6895 | + | |
| 6896 | + | |
| 6897 | + | |
| 6898 | + | |
| 6899 | + | |
| 6900 | + | |
| 6901 | + | |
| 6902 | + | |
| 6903 | + | |
| 6904 | + | |
| 6905 | + | |
| 6906 | + | |
6883 | 6907 |
| |
6884 | 6908 |
| |
6885 | 6909 |
| |
|
Lines changed: 16 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2568 | 2568 |
| |
2569 | 2569 |
| |
2570 | 2570 |
| |
2571 |
| - | |
| 2571 | + | |
2572 | 2572 |
| |
2573 | 2573 |
| |
2574 | 2574 |
| |
| |||
2622 | 2622 |
| |
2623 | 2623 |
| |
2624 | 2624 |
| |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
| 2630 | + | |
| 2631 | + | |
| 2632 | + | |
| 2633 | + | |
| 2634 | + | |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
2625 | 2640 |
| |
2626 | 2641 |
| |
2627 | 2642 |
| |
|
0 commit comments
Comments
(0)