forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb538e83
committed
Be more careful about the shape of hashable subplan clauses.
nodeSubplan.c expects that the testexpr for a hashable ANY SubPlanhas the form of one or more OpExprs whose LHS is an expression of theouter query's, while the RHS is an expression over Params representingoutput columns of the subquery. However, the planner only went as faras verifying that the clauses were all binary OpExprs. This works99.99% of the time, because the clauses have the right shape whenemitted by the parser --- but it's possible for function inlining tobreak that, as reported by PegoraroF10. To fix, teach the plannerto check that the LHS and RHS contain the right things, or moreaccurately don't contain the wrong things. Given that this has beenbroken for years without anyone noticing, it seems sufficient to justgive up hashing when it happens, rather than go to the trouble ofcommuting the clauses back again (which wouldn't necessarily workanyway).While poking at that, I also noticed that nodeSubplan.c had a baked-inassumption that the number of hash clauses is identical to the numberof subquery output columns. Again, that's fine as far as parser outputgoes, but it's not hard to break it via function inlining. There seemslittle reason for that assumption though --- AFAICS, the only thingit's buying us is not having to store the number of hash clausesexplicitly. Adding code to the planner to reject such cases would takemore code than getting nodeSubplan.c to cope, so I fixed it that way.This has been broken for as long as we've had hashable SubPlans,so back-patch to all supported branches.Discussion:https://postgr.es/m/1549209182255-0.post@n3.nabble.com1 parentb7cc21c commitb538e83
File tree
7 files changed
+219
-30
lines changed- src
- backend
- executor
- optimizer
- plan
- util
- include
- nodes
- optimizer
- test/regress
- expected
- sql
7 files changed
+219
-30
lines changedLines changed: 8 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
471 | 471 |
| |
472 | 472 |
| |
473 | 473 |
| |
474 |
| - | |
| 474 | + | |
475 | 475 |
| |
476 | 476 |
| |
477 | 477 |
| |
| |||
878 | 878 |
| |
879 | 879 |
| |
880 | 880 |
| |
881 |
| - | |
882 |
| - | |
883 |
| - | |
884 |
| - | |
885 |
| - | |
886 | 881 |
| |
887 | 882 |
| |
888 | 883 |
| |
| |||
914 | 909 |
| |
915 | 910 |
| |
916 | 911 |
| |
917 |
| - | |
| 912 | + | |
918 | 913 |
| |
919 | 914 |
| |
| 915 | + | |
| 916 | + | |
920 | 917 |
| |
| 918 | + | |
921 | 919 |
| |
922 | 920 |
| |
923 |
| - | |
924 | 921 |
| |
925 | 922 |
| |
926 | 923 |
| |
| |||
979 | 976 |
| |
980 | 977 |
| |
981 | 978 |
| |
| 979 | + | |
| 980 | + | |
| 981 | + | |
982 | 982 |
| |
983 | 983 |
| |
984 | 984 |
| |
|
Lines changed: 55 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
69 | 69 |
| |
70 | 70 |
| |
71 | 71 |
| |
72 |
| - | |
| 72 | + | |
73 | 73 |
| |
74 | 74 |
| |
75 | 75 |
| |
| |||
81 | 81 |
| |
82 | 82 |
| |
83 | 83 |
| |
84 |
| - | |
| 84 | + | |
| 85 | + | |
85 | 86 |
| |
86 | 87 |
| |
87 | 88 |
| |
| |||
237 | 238 |
| |
238 | 239 |
| |
239 | 240 |
| |
240 |
| - | |
| 241 | + | |
241 | 242 |
| |
242 | 243 |
| |
243 | 244 |
| |
| |||
291 | 292 |
| |
292 | 293 |
| |
293 | 294 |
| |
294 |
| - | |
| 295 | + | |
| 296 | + | |
295 | 297 |
| |
296 | 298 |
| |
297 | 299 |
| |
298 |
| - | |
299 |
| - | |
300 | 300 |
| |
301 | 301 |
| |
302 | 302 |
| |
| |||
319 | 319 |
| |
320 | 320 |
| |
321 | 321 |
| |
322 |
| - | |
| 322 | + | |
323 | 323 |
| |
324 | 324 |
| |
325 | 325 |
| |
| |||
484 | 484 |
| |
485 | 485 |
| |
486 | 486 |
| |
487 |
| - | |
488 |
| - | |
| 487 | + | |
| 488 | + | |
489 | 489 |
| |
490 |
| - | |
| 490 | + | |
491 | 491 |
| |
492 | 492 |
| |
493 | 493 |
| |
| |||
499 | 499 |
| |
500 | 500 |
| |
501 | 501 |
| |
| 502 | + | |
502 | 503 |
| |
| 504 | + | |
| 505 | + | |
503 | 506 |
| |
504 | 507 |
| |
505 | 508 |
| |
| |||
511 | 514 |
| |
512 | 515 |
| |
513 | 516 |
| |
514 |
| - | |
| 517 | + | |
515 | 518 |
| |
516 | 519 |
| |
517 | 520 |
| |
| |||
734 | 737 |
| |
735 | 738 |
| |
736 | 739 |
| |
| 740 | + | |
| 741 | + | |
| 742 | + | |
737 | 743 |
| |
738 | 744 |
| |
739 |
| - | |
| 745 | + | |
740 | 746 |
| |
741 | 747 |
| |
742 | 748 |
| |
743 |
| - | |
744 |
| - | |
745 |
| - | |
746 |
| - | |
747 |
| - | |
748 |
| - | |
749 |
| - | |
750 |
| - | |
| 749 | + | |
751 | 750 |
| |
752 | 751 |
| |
753 | 752 |
| |
754 |
| - | |
| 753 | + | |
755 | 754 |
| |
756 | 755 |
| |
757 | 756 |
| |
| |||
764 | 763 |
| |
765 | 764 |
| |
766 | 765 |
| |
767 |
| - | |
| 766 | + | |
768 | 767 |
| |
769 | 768 |
| |
770 | 769 |
| |
| |||
773 | 772 |
| |
774 | 773 |
| |
775 | 774 |
| |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 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 | + | |
776 | 809 |
| |
777 | 810 |
| |
778 | 811 |
| |
|
Lines changed: 35 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
108 | 108 |
| |
109 | 109 |
| |
110 | 110 |
| |
| 111 | + | |
111 | 112 |
| |
112 | 113 |
| |
113 | 114 |
| |
| |||
1221 | 1222 |
| |
1222 | 1223 |
| |
1223 | 1224 |
| |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
1224 | 1259 |
| |
1225 | 1260 |
| |
1226 | 1261 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
867 | 867 |
| |
868 | 868 |
| |
869 | 869 |
| |
| 870 | + | |
| 871 | + | |
870 | 872 |
| |
871 | 873 |
| |
872 | 874 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
| 41 | + | |
41 | 42 |
| |
42 | 43 |
| |
43 | 44 |
| |
|
Lines changed: 77 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
757 | 757 |
| |
758 | 758 |
| |
759 | 759 |
| |
| 760 | + | |
760 | 761 |
| |
761 | 762 |
| |
762 | 763 |
| |
| |||
797 | 798 |
| |
798 | 799 |
| |
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 | + | |
800 | 877 |
| |
801 | 878 |
| |
802 | 879 |
| |
|
0 commit comments
Comments
(0)