- Notifications
You must be signed in to change notification settings - Fork28
Commit4a50de1
committed
Fix bogus optimization in JSONB containment tests.
When determining whether one JSONB object contains another, it's okay tomake a quick exit if the first object has fewer pairs than the second:because we de-duplicate keys within objects, it is impossible that thefirst object has all the keys the second does. However, the code wasapplying this rule to JSONB arrays as well, where it does *not* holdbecause arrays can contain duplicate entries. The test was really inthe wrong place anyway; we should do it within JsonbDeepContains, whereit can be applied to nested objects not only top-level ones.Report and test cases by Alexander Korotkov; fix by Peter Geoghegan andTom Lane.1 parent733be2a commit4a50de1
File tree
5 files changed
+97
-8
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
5 files changed
+97
-8
lines changedLines changed: 4 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
60 |
| - | |
| 60 | + | |
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
| |||
90 | 90 |
| |
91 | 91 |
| |
92 | 92 |
| |
93 |
| - | |
| 93 | + | |
94 | 94 |
| |
95 | 95 |
| |
96 | 96 |
| |
| |||
117 | 117 |
| |
118 | 118 |
| |
119 | 119 |
| |
120 |
| - | |
121 |
| - | |
| 120 | + | |
122 | 121 |
| |
123 | 122 |
| |
124 | 123 |
| |
| |||
137 | 136 |
| |
138 | 137 |
| |
139 | 138 |
| |
140 |
| - | |
141 |
| - | |
| 139 | + | |
142 | 140 |
| |
143 | 141 |
| |
144 | 142 |
| |
|
Lines changed: 14 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
957 | 957 |
| |
958 | 958 |
| |
959 | 959 |
| |
960 |
| - | |
961 |
| - | |
| 960 | + | |
962 | 961 |
| |
963 | 962 |
| |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
964 | 973 |
| |
965 | 974 |
| |
966 | 975 |
| |
| 976 | + | |
| 977 | + | |
967 | 978 |
| |
968 | 979 |
| |
969 | 980 |
| |
| |||
1047 | 1058 |
| |
1048 | 1059 |
| |
1049 | 1060 |
| |
| 1061 | + | |
1050 | 1062 |
| |
1051 | 1063 |
| |
1052 | 1064 |
| |
|
Lines changed: 36 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
707 | 707 |
| |
708 | 708 |
| |
709 | 709 |
| |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
710 | 746 |
| |
711 | 747 |
| |
712 | 748 |
| |
|
Lines changed: 36 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
707 | 707 |
| |
708 | 708 |
| |
709 | 709 |
| |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
710 | 746 |
| |
711 | 747 |
| |
712 | 748 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
156 | 156 |
| |
157 | 157 |
| |
158 | 158 |
| |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
159 | 166 |
| |
160 | 167 |
| |
161 | 168 |
| |
|
0 commit comments
Comments
(0)