- Notifications
You must be signed in to change notification settings - Fork5
Commitff673f5
committed
Fix convert_IN_to_join to properly handle the case where the subselect's
output is not of the same type that's needed for the IN comparison (ie,where the parser inserted an implicit coercion above the subselect result).We should record the coerced expression, not just a raw Var referencingthe subselect output, as the quantity that needs to be unique-ified ifwe choose to implement the IN as Unique followed by a plain join.As of 8.3 this error was causing crashes, as seen in bug #4113 from JavierHernandez, because the executor was being told to hash or sort the rawsubselect output column using operators appropriate to the coerced type.In prior versions there was no crash because the executor chose thehash or sort operators for itself based on the column type it saw.However, that's still not really right, because what's unique for one datatype might not be unique for another. In corner cases we could get multipleoutputs of a row that should appear only once, as demonstrated by theregression test case included in this commit.However, this patch doesn't apply cleanly to 8.2 or before, and the codeinvolved has shifted enough over time that I'm hesitant to try to back-patch.Given the lack of complaints from the field about such corner cases, I thinkthe bug may not be important enough to risk breaking other things with aback-patch.1 parenta31b03b commitff673f5
File tree
5 files changed
+104
-25
lines changed- src
- backend/optimizer
- plan
- util
- include/nodes
- test/regress
- expected
- sql
5 files changed
+104
-25
lines changedLines changed: 43 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
725 | 725 |
| |
726 | 726 |
| |
727 | 727 |
| |
| 728 | + | |
| 729 | + | |
728 | 730 |
| |
729 | 731 |
| |
730 | 732 |
| |
731 | 733 |
| |
| 734 | + | |
732 | 735 |
| |
733 | 736 |
| |
734 | 737 |
| |
| |||
744 | 747 |
| |
745 | 748 |
| |
746 | 749 |
| |
747 |
| - | |
| 750 | + | |
| 751 | + | |
748 | 752 |
| |
749 | 753 |
| |
750 | 754 |
| |
| 755 | + | |
| 756 | + | |
751 | 757 |
| |
752 | 758 |
| |
753 | 759 |
| |
754 | 760 |
| |
| 761 | + | |
| 762 | + | |
755 | 763 |
| |
756 | 764 |
| |
757 | 765 |
| |
758 | 766 |
| |
759 | 767 |
| |
760 |
| - | |
761 |
| - | |
| 768 | + | |
| 769 | + | |
762 | 770 |
| |
763 | 771 |
| |
764 | 772 |
| |
765 | 773 |
| |
766 | 774 |
| |
767 | 775 |
| |
| 776 | + | |
| 777 | + | |
768 | 778 |
| |
| 779 | + | |
| 780 | + | |
769 | 781 |
| |
770 | 782 |
| |
771 | 783 |
| |
| |||
782 | 794 |
| |
783 | 795 |
| |
784 | 796 |
| |
785 |
| - | |
| 797 | + | |
786 | 798 |
| |
787 | 799 |
| |
788 | 800 |
| |
| 801 | + | |
| 802 | + | |
| 803 | + | |
789 | 804 |
| |
790 | 805 |
| |
791 | 806 |
| |
| |||
810 | 825 |
| |
811 | 826 |
| |
812 | 827 |
| |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
813 | 842 |
| |
814 | 843 |
| |
815 | 844 |
| |
| |||
819 | 848 |
| |
820 | 849 |
| |
821 | 850 |
| |
822 |
| - | |
823 |
| - | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
824 | 857 |
| |
825 |
| - | |
826 |
| - | |
827 |
| - | |
828 |
| - | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
829 | 861 |
| |
830 | 862 |
| |
831 | 863 |
| |
832 | 864 |
| |
833 |
| - | |
834 |
| - | |
835 |
| - | |
836 |
| - | |
837 |
| - | |
838 |
| - | |
839 |
| - | |
840 | 865 |
| |
841 | 866 |
| |
842 | 867 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
898 | 898 |
| |
899 | 899 |
| |
900 | 900 |
| |
901 |
| - | |
| 901 | + | |
902 | 902 |
| |
903 | 903 |
| |
904 | 904 |
| |
|
Lines changed: 7 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
1107 | 1107 |
| |
1108 | 1108 |
| |
1109 | 1109 |
| |
1110 |
| - | |
1111 |
| - | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
1112 | 1114 |
| |
1113 | 1115 |
| |
1114 | 1116 |
| |
1115 | 1117 |
| |
1116 | 1118 |
| |
1117 | 1119 |
| |
1118 | 1120 |
| |
1119 |
| - | |
1120 |
| - | |
| 1121 | + | |
| 1122 | + | |
1121 | 1123 |
| |
1122 | 1124 |
| |
1123 | 1125 |
| |
|
Lines changed: 31 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
408 | 408 |
| |
409 | 409 |
| |
410 | 410 |
| |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + |
Lines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
251 | 251 |
| |
252 | 252 |
| |
253 | 253 |
| |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + |
0 commit comments
Comments
(0)