forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9df8f90
committed
Fix some issues with improper placement of outer join clauses.
After applying outer-join identity 3 in the forward direction,it was possible for the planner to mistakenly apply a qual clausefrom above the two outer joins at the now-lower join level.This can give the wrong answer, since a value that would get nulledby the now-upper join might not yet be null.To fix, when we perform such a transformation, consider that thenow-lower join hasn't really completed the outer join it's nominallyresponsible for and thus its relid set should not include that OJ'srelid (nor should its output Vars have that nullingrel bit set).Instead we add those bits when the now-upper join is performed.The existing rules for qual placement then suffice to preventhigher qual clauses from dropping below the now-upper join.There are a few complications from needing to consider transitiveclosures in case multiple pushdowns have happened, but all in allit's not a very complex patch.This is all new logic (from2489d76) so no need to back-patch.The added test cases all have the same results as in v15.Tom Lane and Richard GuoDiscussion:https://postgr.es/m/0b819232-4b50-f245-1c7d-c8c61bf41827@postgrespro.ru1 parent867be9c commit9df8f90
File tree
14 files changed
+450
-86
lines changed- src
- backend/optimizer
- path
- plan
- util
- include
- nodes
- optimizer
- test/regress
- expected
- sql
14 files changed
+450
-86
lines changedLines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
507 | 507 |
| |
508 | 508 |
| |
509 | 509 |
| |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
510 | 531 |
| |
511 | 532 |
| |
512 | 533 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4789 | 4789 |
| |
4790 | 4790 |
| |
4791 | 4791 |
| |
4792 |
| - | |
| 4792 | + | |
| 4793 | + | |
4793 | 4794 |
| |
4794 | 4795 |
| |
4795 | 4796 |
| |
| |||
4957 | 4958 |
| |
4958 | 4959 |
| |
4959 | 4960 |
| |
4960 |
| - | |
| 4961 | + | |
| 4962 | + | |
4961 | 4963 |
| |
4962 | 4964 |
| |
4963 | 4965 |
| |
|
Lines changed: 12 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1366 | 1366 |
| |
1367 | 1367 |
| |
1368 | 1368 |
| |
1369 |
| - | |
1370 |
| - | |
| 1369 | + | |
| 1370 | + | |
1371 | 1371 |
| |
1372 | 1372 |
| |
1373 |
| - | |
1374 |
| - | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
1375 | 1376 |
| |
1376 | 1377 |
| |
1377 | 1378 |
| |
1378 | 1379 |
| |
1379 | 1380 |
| |
1380 | 1381 |
| |
1381 |
| - | |
| 1382 | + | |
1382 | 1383 |
| |
1383 | 1384 |
| |
1384 | 1385 |
| |
| |||
1396 | 1397 |
| |
1397 | 1398 |
| |
1398 | 1399 |
| |
1399 |
| - | |
1400 |
| - | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
1401 | 1404 |
| |
1402 | 1405 |
| |
1403 | 1406 |
| |
| |||
1418 | 1421 |
| |
1419 | 1422 |
| |
1420 | 1423 |
| |
1421 |
| - | |
| 1424 | + | |
1422 | 1425 |
| |
1423 | 1426 |
| |
1424 | 1427 |
| |
| |||
1467 | 1470 |
| |
1468 | 1471 |
| |
1469 | 1472 |
| |
1470 |
| - | |
| 1473 | + | |
1471 | 1474 |
| |
1472 | 1475 |
| |
1473 | 1476 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3364 | 3364 |
| |
3365 | 3365 |
| |
3366 | 3366 |
| |
3367 |
| - | |
| 3367 | + | |
3368 | 3368 |
| |
3369 | 3369 |
| |
3370 | 3370 |
| |
|
Lines changed: 115 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
691 | 691 |
| |
692 | 692 |
| |
693 | 693 |
| |
| 694 | + | |
694 | 695 |
| |
695 | 696 |
| |
696 | 697 |
| |
| |||
710 | 711 |
| |
711 | 712 |
| |
712 | 713 |
| |
713 |
| - | |
714 |
| - | |
715 |
| - | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
716 | 720 |
| |
717 | 721 |
| |
718 | 722 |
| |
| |||
740 | 744 |
| |
741 | 745 |
| |
742 | 746 |
| |
743 |
| - | |
| 747 | + | |
| 748 | + | |
744 | 749 |
| |
745 | 750 |
| |
746 | 751 |
| |
| |||
753 | 758 |
| |
754 | 759 |
| |
755 | 760 |
| |
756 |
| - | |
| 761 | + | |
| 762 | + | |
757 | 763 |
| |
758 | 764 |
| |
759 | 765 |
| |
| |||
775 | 781 |
| |
776 | 782 |
| |
777 | 783 |
| |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
778 | 886 |
| |
779 | 887 |
| |
780 | 888 |
| |
| |||
1534 | 1642 |
| |
1535 | 1643 |
| |
1536 | 1644 |
| |
1537 |
| - | |
1538 |
| - | |
1539 |
| - | |
| 1645 | + | |
| 1646 | + | |
1540 | 1647 |
| |
1541 | 1648 |
| |
1542 | 1649 |
| |
|
Lines changed: 10 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
91 |
| - | |
92 |
| - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
93 | 96 |
| |
94 | 97 |
| |
95 | 98 |
| |
| |||
201 | 204 |
| |
202 | 205 |
| |
203 | 206 |
| |
204 |
| - | |
205 |
| - | |
| 207 | + | |
| 208 | + | |
206 | 209 |
| |
207 | 210 |
| |
208 | 211 |
| |
| |||
399 | 402 |
| |
400 | 403 |
| |
401 | 404 |
| |
402 |
| - | |
| 405 | + | |
| 406 | + | |
403 | 407 |
| |
404 | 408 |
| |
405 | 409 |
| |
| |||
665 | 669 |
| |
666 | 670 |
| |
667 | 671 |
| |
668 |
| - | |
| 672 | + | |
669 | 673 |
| |
670 | 674 |
| |
671 | 675 |
| |
|
0 commit comments
Comments
(0)