forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit85b7efa
committed
Support LIKE with nondeterministic collations
This allows for example using LIKE with case-insensitive collations.There was previously no internal implementation of this, so it was metwith a not-supported error. This adds the internal implementation andremoves the error. The implementation follows the specification ofthe SQL standard for this.Unlike with deterministic collations, the LIKE matching cannot gocharacter by character but has to go substring by substring. Forexample, if we are matching against LIKE 'foo%bar', we can't start bylooking for an 'f', then an 'o', but instead with have to findsomething that matches 'foo'. This is because the collation couldconsider substrings of different lengths to be equal. This is allinternal to MatchText() in like_match.c.The changes in GenericMatchText() in like.c just pass through thelocale information to MatchText(), which was previously not needed.This matches exactly Generic_Text_IC_like() below.ILIKE is not affected. (It's unclear whether ILIKE makes sense undernondeterministic collations.)This also updates match_pattern_prefix() in like_support.c to supportoptimizing the case of an exact pattern with nondeterministiccollations. This was already alluded to in the previous code.(includes documentation examples from Daniel Vérité and test casesfrom Paul A Jungwirth)Reviewed-by: Jian He <jian.universality@gmail.com>Discussion:https://www.postgresql.org/message-id/flat/700d2e86-bf75-4607-9cf2-f5b7802f6e88@eisentraut.org1 parent8fcd802 commit85b7efa
File tree
7 files changed
+458
-44
lines changed- doc/src/sgml
- src
- backend/utils/adt
- test/regress
- expected
- sql
7 files changed
+458
-44
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1197 | 1197 |
| |
1198 | 1198 |
| |
1199 | 1199 |
| |
1200 |
| - | |
| 1200 | + | |
1201 | 1201 |
| |
1202 | 1202 |
| |
1203 | 1203 |
| |
|
Lines changed: 47 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5414 | 5414 |
| |
5415 | 5415 |
| |
5416 | 5416 |
| |
5417 |
| - | |
5418 |
| - | |
5419 |
| - | |
| 5417 | + | |
| 5418 | + | |
| 5419 | + | |
| 5420 | + | |
5420 | 5421 |
| |
5421 | 5422 |
| |
5422 | 5423 |
| |
| |||
5462 | 5463 |
| |
5463 | 5464 |
| |
5464 | 5465 |
| |
| 5466 | + | |
| 5467 | + | |
| 5468 | + | |
| 5469 | + | |
| 5470 | + | |
| 5471 | + | |
| 5472 | + | |
| 5473 | + | |
| 5474 | + | |
| 5475 | + | |
| 5476 | + | |
| 5477 | + | |
| 5478 | + | |
| 5479 | + | |
| 5480 | + | |
| 5481 | + | |
| 5482 | + | |
| 5483 | + | |
| 5484 | + | |
| 5485 | + | |
| 5486 | + | |
| 5487 | + | |
| 5488 | + | |
| 5489 | + | |
| 5490 | + | |
| 5491 | + | |
| 5492 | + | |
| 5493 | + | |
| 5494 | + | |
| 5495 | + | |
| 5496 | + | |
| 5497 | + | |
| 5498 | + | |
| 5499 | + | |
| 5500 | + | |
| 5501 | + | |
| 5502 | + | |
| 5503 | + | |
| 5504 | + | |
| 5505 | + | |
5465 | 5506 |
| |
5466 | 5507 |
| |
5467 | 5508 |
| |
| |||
5503 | 5544 |
| |
5504 | 5545 |
| |
5505 | 5546 |
| |
5506 |
| - | |
5507 |
| - | |
| 5547 | + | |
| 5548 | + | |
| 5549 | + | |
5508 | 5550 |
| |
5509 | 5551 |
| |
5510 | 5552 |
| |
|
Lines changed: 16 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
147 | 147 |
| |
148 | 148 |
| |
149 | 149 |
| |
150 |
| - | |
151 |
| - | |
152 |
| - | |
| 150 | + | |
153 | 151 |
| |
154 |
| - | |
155 |
| - | |
156 |
| - | |
157 |
| - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
158 | 162 |
| |
159 | 163 |
| |
| 164 | + | |
| 165 | + | |
160 | 166 |
| |
161 |
| - | |
| 167 | + | |
162 | 168 |
| |
163 |
| - | |
| 169 | + | |
164 | 170 |
| |
165 |
| - | |
| 171 | + | |
166 | 172 |
| |
167 | 173 |
| |
168 | 174 |
| |
|
Lines changed: 147 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
157 | 157 |
| |
158 | 158 |
| |
159 | 159 |
| |
160 |
| - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
161 | 163 |
| |
162 | 164 |
| |
163 | 165 |
| |
| |||
172 | 174 |
| |
173 | 175 |
| |
174 | 176 |
| |
175 |
| - | |
| 177 | + | |
176 | 178 |
| |
177 | 179 |
| |
178 | 180 |
| |
| |||
196 | 198 |
| |
197 | 199 |
| |
198 | 200 |
| |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
199 | 344 |
| |
200 | 345 |
| |
201 | 346 |
| |
|
Lines changed: 13 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
272 | 272 |
| |
273 | 273 |
| |
274 | 274 |
| |
275 |
| - | |
276 |
| - | |
277 |
| - | |
278 |
| - | |
279 |
| - | |
280 |
| - | |
281 |
| - | |
282 |
| - | |
283 |
| - | |
284 |
| - | |
285 |
| - | |
286 |
| - | |
287 |
| - | |
288 |
| - | |
289 |
| - | |
290 |
| - | |
291 | 275 |
| |
292 | 276 |
| |
293 | 277 |
| |
| |||
404 | 388 |
| |
405 | 389 |
| |
406 | 390 |
| |
| 391 | + | |
| 392 | + | |
407 | 393 |
| |
408 | 394 |
| |
409 | 395 |
| |
410 | 396 |
| |
411 | 397 |
| |
412 | 398 |
| |
413 | 399 |
| |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
414 | 411 |
| |
415 | 412 |
| |
416 | 413 |
| |
|
0 commit comments
Comments
(0)