forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitccbb54c
committed
Further fixes for MULTIEXPR_SUBLINK fix.
Some more things I didn't think about in commits3f7323c et al:MULTIEXPR_SUBLINK subplans might have been converted to initplansinstead of regular subplans, in which case they won't show up inthe modified targetlist. Fortunately, this would only happen ifthey have no input parameters, which means that the problem weoriginally needed to fix can't happen with them. Therefore, there'sno need to clone their output parameters, and thus it doesn't hurtthat we'll fail to see them in the first pass over the targetlist.Nonetheless, this complicates matters greatly, because now we haveto distinguish output Params of initplans (which shouldn't getrenumbered) from those of regular subplans (which should).This also breaks the simplistic scheme I used of assuming that thesubplans found in the targetlist have consecutive subLinkIds.We really can't avoid the need to know the subplans' subLinkIds inthis code. To fix that, add subLinkId as the last field of SubPlan.We can get away with that change in back branches because SubPlannodes will never be stored in the catalogs, and there's no ABIbreak for external code that might be looking at the existingfields of SubPlan.Secondly, rewriteTargetListIU might have rolled up multipleFieldStores or SubscriptingRefs into one targetlist entry,breaking the assumption that there's at most one Param to fixper targetlist entry. (That assumption is OK I think in theruleutils.c code I stole the logic from in18f5108, becausethat only deals with pre-rewrite query trees. But it'sdefinitely not OK here.) Abandon that shortcut and just do afull tree walk on the targetlist to ensure we find all theParams we have to change.Per bug #17606 from Andre Lin. As before, only v10-v13 need thepatch.Discussion:https://postgr.es/m/17606-e5c8ad18d31db96a@postgresql.org1 parent43e409c commitccbb54c
File tree
8 files changed
+119
-83
lines changed- src
- backend
- nodes
- optimizer/plan
- include/nodes
- test/regress
- expected
- sql
8 files changed
+119
-83
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1719 | 1719 |
| |
1720 | 1720 |
| |
1721 | 1721 |
| |
| 1722 | + | |
1722 | 1723 |
| |
1723 | 1724 |
| |
1724 | 1725 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
455 | 455 |
| |
456 | 456 |
| |
457 | 457 |
| |
| 458 | + | |
458 | 459 |
| |
459 | 460 |
| |
460 | 461 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1349 | 1349 |
| |
1350 | 1350 |
| |
1351 | 1351 |
| |
| 1352 | + | |
1352 | 1353 |
| |
1353 | 1354 |
| |
1354 | 1355 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2536 | 2536 |
| |
2537 | 2537 |
| |
2538 | 2538 |
| |
| 2539 | + | |
2539 | 2540 |
| |
2540 | 2541 |
| |
2541 | 2542 |
| |
|
Lines changed: 71 additions & 68 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
86 | 86 |
| |
87 | 87 |
| |
88 | 88 |
| |
| 89 | + | |
89 | 90 |
| |
90 | 91 |
| |
91 | 92 |
| |
| |||
335 | 336 |
| |
336 | 337 |
| |
337 | 338 |
| |
| 339 | + | |
338 | 340 |
| |
339 | 341 |
| |
340 | 342 |
| |
| |||
858 | 860 |
| |
859 | 861 |
| |
860 | 862 |
| |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
861 | 869 |
| |
862 | 870 |
| |
863 | 871 |
| |
864 | 872 |
| |
865 |
| - | |
866 |
| - | |
| 873 | + | |
867 | 874 |
| |
868 | 875 |
| |
869 | 876 |
| |
| |||
876 | 883 |
| |
877 | 884 |
| |
878 | 885 |
| |
| 886 | + | |
| 887 | + | |
| 888 | + | |
879 | 889 |
| |
880 | 890 |
| |
881 | 891 |
| |
| |||
898 | 908 |
| |
899 | 909 |
| |
900 | 910 |
| |
901 |
| - | |
902 |
| - | |
903 |
| - | |
904 |
| - | |
905 |
| - | |
906 |
| - | |
907 |
| - | |
908 |
| - | |
909 |
| - | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
910 | 914 |
| |
911 |
| - | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
912 | 931 |
| |
913 | 932 |
| |
914 | 933 |
| |
915 |
| - | |
916 |
| - | |
917 |
| - | |
918 |
| - | |
919 |
| - | |
920 |
| - | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
921 | 939 |
| |
922 |
| - | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
923 | 944 |
| |
924 |
| - | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
925 | 955 |
| |
926 |
| - | |
927 |
| - | |
928 |
| - | |
| 956 | + | |
| 957 | + | |
929 | 958 |
| |
930 | 959 |
| |
| 960 | + | |
931 | 961 |
| |
932 |
| - | |
933 |
| - | |
934 |
| - | |
935 |
| - | |
936 |
| - | |
937 |
| - | |
938 |
| - | |
939 |
| - | |
940 |
| - | |
941 |
| - | |
942 |
| - | |
943 |
| - | |
944 |
| - | |
945 |
| - | |
946 |
| - | |
947 |
| - | |
948 |
| - | |
949 |
| - | |
950 |
| - | |
951 |
| - | |
952 |
| - | |
953 |
| - | |
954 |
| - | |
955 |
| - | |
956 |
| - | |
957 |
| - | |
958 |
| - | |
959 |
| - | |
960 |
| - | |
961 |
| - | |
962 |
| - | |
963 |
| - | |
964 |
| - | |
965 | 962 |
| |
966 |
| - | |
| 963 | + | |
967 | 964 |
| |
968 | 965 |
| |
969 |
| - | |
970 |
| - | |
971 |
| - | |
972 |
| - | |
973 |
| - | |
974 |
| - | |
975 |
| - | |
976 |
| - | |
977 | 966 |
| |
978 |
| - | |
979 |
| - | |
980 |
| - | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
981 | 982 |
| |
982 | 983 |
| |
983 | 984 |
| |
| |||
1110 | 1111 |
| |
1111 | 1112 |
| |
1112 | 1113 |
| |
| 1114 | + | |
1113 | 1115 |
| |
1114 | 1116 |
| |
1115 | 1117 |
| |
| |||
3075 | 3077 |
| |
3076 | 3078 |
| |
3077 | 3079 |
| |
| 3080 | + | |
3078 | 3081 |
| |
3079 | 3082 |
| |
3080 | 3083 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
731 | 731 |
| |
732 | 732 |
| |
733 | 733 |
| |
| 734 | + | |
| 735 | + | |
734 | 736 |
| |
735 | 737 |
| |
736 | 738 |
| |
|
Lines changed: 31 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1717 | 1717 |
| |
1718 | 1718 |
| |
1719 | 1719 |
| |
1720 |
| - | |
| 1720 | + | |
1721 | 1721 |
| |
1722 | 1722 |
| |
1723 | 1723 |
| |
1724 | 1724 |
| |
1725 | 1725 |
| |
1726 | 1726 |
| |
1727 |
| - | |
1728 |
| - | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
1729 | 1732 |
| |
1730 |
| - | |
1731 |
| - | |
| 1733 | + | |
| 1734 | + | |
1732 | 1735 |
| |
1733 | 1736 |
| |
1734 | 1737 |
| |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
1735 | 1748 |
| |
1736 |
| - | |
| 1749 | + | |
1737 | 1750 |
| |
1738 | 1751 |
| |
1739 | 1752 |
| |
| |||
1747 | 1760 |
| |
1748 | 1761 |
| |
1749 | 1762 |
| |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
1750 | 1768 |
| |
1751 |
| - | |
| 1769 | + | |
1752 | 1770 |
| |
1753 | 1771 |
| |
1754 | 1772 |
| |
1755 | 1773 |
| |
1756 | 1774 |
| |
1757 | 1775 |
| |
1758 | 1776 |
| |
1759 |
| - | |
| 1777 | + | |
1760 | 1778 |
| |
1761 |
| - | |
1762 |
| - | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
1763 | 1784 |
| |
1764 | 1785 |
| |
1765 | 1786 |
| |
|
Lines changed: 11 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
632 | 632 |
| |
633 | 633 |
| |
634 | 634 |
| |
635 |
| - | |
| 635 | + | |
636 | 636 |
| |
637 | 637 |
| |
638 | 638 |
| |
639 | 639 |
| |
640 | 640 |
| |
641 | 641 |
| |
642 | 642 |
| |
643 |
| - | |
644 |
| - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
645 | 648 |
| |
646 |
| - | |
647 |
| - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
648 | 654 |
| |
649 | 655 |
| |
650 | 656 |
| |
|
0 commit comments
Comments
(0)