- Notifications
You must be signed in to change notification settings - Fork5
Commita396144
committed
Remove new coupling between NAMEDATALEN and MAX_LEVENSHTEIN_STRLEN.
Commite529cd4 introduced an Assert requiring NAMEDATALEN to beless than MAX_LEVENSHTEIN_STRLEN, which has been 255 for a long time.Since up to that instant we had always allowed NAMEDATALEN to besubstantially more than that, this was ill-advised.It's debatable whether we need MAX_LEVENSHTEIN_STRLEN at all (versusputting a CHECK_FOR_INTERRUPTS into the loop), or whether it has to beso tight; but this patch takes the narrower approach of just not applyingthe MAX_LEVENSHTEIN_STRLEN limit to calls from the parser.Trusting the parser for this seems reasonable, first because the stringsare limited to NAMEDATALEN which is unlikely to be hugely more than 256,and second because the maximum distance is tightly constrained byMAX_FUZZY_DISTANCE (though we'd forgotten to make use of that limit in oneplace). That means the cost is not really O(mn) but more like O(max(m,n)).Relaxing the limit for user-supplied calls is left for future research;given the lack of complaints to date, it doesn't seem very high priority.In passing, fix confusion between lengths-in-bytes and lengths-in-charsin comments and error messages.Per gripe from Kevin Day; solution suggested by Robert Haas. Back-patchto 9.5 where the unwanted restriction was introduced.1 parent647d87c commita396144
File tree
4 files changed
+60
-45
lines changed- contrib/fuzzystrmatch
- src
- backend
- parser
- utils/adt
- include/utils
4 files changed
+60
-45
lines changedLines changed: 16 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
171 | 171 |
| |
172 | 172 |
| |
173 | 173 |
| |
174 |
| - | |
| 174 | + | |
175 | 175 |
| |
176 | 176 |
| |
177 | 177 |
| |
178 |
| - | |
179 |
| - | |
| 178 | + | |
| 179 | + | |
180 | 180 |
| |
181 | 181 |
| |
182 | 182 |
| |
| |||
194 | 194 |
| |
195 | 195 |
| |
196 | 196 |
| |
197 |
| - | |
| 197 | + | |
198 | 198 |
| |
199 | 199 |
| |
200 | 200 |
| |
201 |
| - | |
202 |
| - | |
| 201 | + | |
| 202 | + | |
203 | 203 |
| |
204 | 204 |
| |
205 | 205 |
| |
| |||
221 | 221 |
| |
222 | 222 |
| |
223 | 223 |
| |
224 |
| - | |
| 224 | + | |
225 | 225 |
| |
226 | 226 |
| |
227 | 227 |
| |
228 |
| - | |
229 |
| - | |
230 |
| - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
231 | 232 |
| |
232 | 233 |
| |
233 | 234 |
| |
| |||
246 | 247 |
| |
247 | 248 |
| |
248 | 249 |
| |
249 |
| - | |
| 250 | + | |
250 | 251 |
| |
251 | 252 |
| |
252 | 253 |
| |
253 |
| - | |
254 |
| - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
255 | 258 |
| |
256 | 259 |
| |
257 | 260 |
| |
|
Lines changed: 8 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
550 | 550 |
| |
551 | 551 |
| |
552 | 552 |
| |
553 |
| - | |
| 553 | + | |
| 554 | + | |
554 | 555 |
| |
555 | 556 |
| |
556 | 557 |
| |
| |||
843 | 844 |
| |
844 | 845 |
| |
845 | 846 |
| |
846 |
| - | |
847 |
| - | |
848 |
| - | |
849 |
| - | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
850 | 853 |
| |
851 | 854 |
| |
852 | 855 |
| |
|
Lines changed: 29 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 |
| - | |
30 |
| - | |
31 |
| - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
32 | 39 |
| |
33 | 40 |
| |
34 | 41 |
| |
| |||
43 | 50 |
| |
44 | 51 |
| |
45 | 52 |
| |
46 |
| - | |
| 53 | + | |
47 | 54 |
| |
48 | 55 |
| |
49 | 56 |
| |
| |||
58 | 65 |
| |
59 | 66 |
| |
60 | 67 |
| |
61 |
| - | |
62 |
| - | |
63 |
| - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
64 | 72 |
| |
65 |
| - | |
66 |
| - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
67 | 77 |
| |
68 | 78 |
| |
69 | 79 |
| |
| |||
95 | 105 |
| |
96 | 106 |
| |
97 | 107 |
| |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
105 |
| - | |
106 |
| - | |
| 108 | + | |
107 | 109 |
| |
108 | 110 |
| |
109 | 111 |
| |
| |||
118 | 120 |
| |
119 | 121 |
| |
120 | 122 |
| |
121 |
| - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
122 | 127 |
| |
123 |
| - | |
124 |
| - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
125 | 131 |
| |
126 | 132 |
| |
127 |
| - | |
128 |
| - | |
| 133 | + | |
| 134 | + | |
129 | 135 |
| |
130 | 136 |
| |
131 | 137 |
| |
|
Lines changed: 7 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
810 | 810 |
| |
811 | 811 |
| |
812 | 812 |
| |
813 |
| - | |
814 |
| - | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
815 | 817 |
| |
816 |
| - | |
817 |
| - | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
818 | 821 |
| |
819 | 822 |
| |
820 | 823 |
| |
|
0 commit comments
Comments
(0)