forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitca70bda
committed
Fix issues around strictness of SIMILAR TO.
As a result of some long-ago quick hacks, the SIMILAR TO operatorand the corresponding flavor of substring() interpreted "ESCAPE NULL"as selecting the default escape character '\'. This is bothsurprising and not per spec: the standard is clear that thesefunctions should return NULL for NULL input.Additionally, because of inconsistency of the strictness markingsof 3-argument substring() and similar_escape(), the planner could notinline the SQL definition of substring(), resulting in a substantialperformance penalty compared to the underlying POSIX substring()function.The simplest fix for this would be to change the strictness markingof similar_escape(), but if we do that we risk breaking existing viewsthat depend on that function. Hence, leave similar_escape() as-isas a compatibility function, and instead invent a new functionsimilar_to_escape() that comes in two strict variants.There are a couple of other behaviors in this area that are alsonot per spec, but they are documented and seem generally at leastas sane as the spec's definition, so leave them alone. But improvethe documentation to describe them fully.Patch by me; thanks to Álvaro Herrera and Andrew Gierth for reviewand discussion.Discussion:https://postgr.es/m/14047.1557708214@sss.pgh.pa.us1 parentc5bc705 commitca70bda
File tree
7 files changed
+193
-41
lines changed- doc/src/sgml
- src
- backend
- parser
- utils/adt
- include/catalog
- test/regress
- expected
- sql
7 files changed
+193
-41
lines changedLines changed: 39 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4121 | 4121 |
| |
4122 | 4122 |
| |
4123 | 4123 |
| |
| 4124 | + | |
| 4125 | + | |
| 4126 | + | |
| 4127 | + | |
| 4128 | + | |
| 4129 | + | |
| 4130 | + | |
| 4131 | + | |
4124 | 4132 |
| |
4125 | 4133 |
| |
4126 | 4134 |
| |
| |||
4139 | 4147 |
| |
4140 | 4148 |
| |
4141 | 4149 |
| |
4142 |
| - | |
4143 |
| - | |
4144 |
| - | |
| 4150 | + | |
| 4151 | + | |
| 4152 | + | |
4145 | 4153 |
| |
4146 | 4154 |
| |
4147 | 4155 |
| |
| |||
4172 | 4180 |
| |
4173 | 4181 |
| |
4174 | 4182 |
| |
4175 |
| - | |
| 4183 | + | |
4176 | 4184 |
| |
4177 | 4185 |
| |
4178 | 4186 |
| |
| |||
4256 | 4264 |
| |
4257 | 4265 |
| |
4258 | 4266 |
| |
4259 |
| - | |
4260 |
| - | |
4261 |
| - | |
| 4267 | + | |
| 4268 | + | |
| 4269 | + | |
| 4270 | + | |
| 4271 | + | |
| 4272 | + | |
| 4273 | + | |
| 4274 | + | |
| 4275 | + | |
| 4276 | + | |
| 4277 | + | |
| 4278 | + | |
| 4279 | + | |
| 4280 | + | |
| 4281 | + | |
| 4282 | + | |
| 4283 | + | |
| 4284 | + | |
| 4285 | + | |
| 4286 | + | |
| 4287 | + | |
4262 | 4288 |
| |
4263 | 4289 |
| |
4264 | 4290 |
| |
4265 | 4291 |
| |
4266 | 4292 |
| |
4267 |
| - | |
4268 |
| - | |
4269 |
| - | |
4270 |
| - | |
| 4293 | + | |
| 4294 | + | |
| 4295 | + | |
| 4296 | + | |
| 4297 | + | |
| 4298 | + | |
4271 | 4299 |
| |
4272 | 4300 |
| |
4273 | 4301 |
| |
|
Lines changed: 8 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13073 | 13073 |
| |
13074 | 13074 |
| |
13075 | 13075 |
| |
13076 |
| - | |
13077 |
| - | |
| 13076 | + | |
| 13077 | + | |
13078 | 13078 |
| |
13079 | 13079 |
| |
13080 | 13080 |
| |
13081 | 13081 |
| |
13082 | 13082 |
| |
13083 | 13083 |
| |
13084 |
| - | |
| 13084 | + | |
13085 | 13085 |
| |
13086 | 13086 |
| |
13087 | 13087 |
| |
13088 | 13088 |
| |
13089 | 13089 |
| |
13090 | 13090 |
| |
13091 | 13091 |
| |
13092 |
| - | |
13093 |
| - | |
| 13092 | + | |
| 13093 | + | |
13094 | 13094 |
| |
13095 | 13095 |
| |
13096 | 13096 |
| |
13097 | 13097 |
| |
13098 | 13098 |
| |
13099 | 13099 |
| |
13100 |
| - | |
| 13100 | + | |
13101 | 13101 |
| |
13102 | 13102 |
| |
13103 | 13103 |
| |
| |||
14323 | 14323 |
| |
14324 | 14324 |
| |
14325 | 14325 |
| |
14326 |
| - | |
| 14326 | + | |
14327 | 14327 |
| |
14328 |
| - | |
| 14328 | + | |
14329 | 14329 |
| |
14330 | 14330 |
| |
14331 | 14331 |
| |
|
Lines changed: 71 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
654 | 654 |
| |
655 | 655 |
| |
656 | 656 |
| |
657 |
| - | |
658 |
| - | |
659 |
| - | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
660 | 665 |
| |
661 |
| - | |
662 |
| - | |
| 666 | + | |
| 667 | + | |
663 | 668 |
| |
664 |
| - | |
665 |
| - | |
666 | 669 |
| |
667 | 670 |
| |
668 | 671 |
| |
| |||
673 | 676 |
| |
674 | 677 |
| |
675 | 678 |
| |
676 |
| - | |
677 |
| - | |
678 |
| - | |
679 |
| - | |
680 | 679 |
| |
681 | 680 |
| |
682 |
| - | |
| 681 | + | |
683 | 682 |
| |
684 | 683 |
| |
685 | 684 |
| |
686 | 685 |
| |
687 | 686 |
| |
688 | 687 |
| |
689 | 688 |
| |
690 |
| - | |
691 | 689 |
| |
692 | 690 |
| |
693 | 691 |
| |
694 | 692 |
| |
695 |
| - | |
| 693 | + | |
696 | 694 |
| |
697 | 695 |
| |
698 | 696 |
| |
| |||
898 | 896 |
| |
899 | 897 |
| |
900 | 898 |
| |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
901 | 958 |
| |
902 | 959 |
| |
903 | 960 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
| 56 | + | |
57 | 57 |
| |
58 | 58 |
|
Lines changed: 10 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3346 | 3346 |
| |
3347 | 3347 |
| |
3348 | 3348 |
| |
3349 |
| - | |
| 3349 | + | |
3350 | 3350 |
| |
3351 | 3351 |
| |
| 3352 | + | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
| 3357 | + | |
3352 | 3358 |
| |
3353 | 3359 |
| |
3354 | 3360 |
| |
| |||
5771 | 5777 |
| |
5772 | 5778 |
| |
5773 | 5779 |
| |
5774 |
| - | |
| 5780 | + | |
5775 | 5781 |
| |
5776 | 5782 |
| |
5777 |
| - | |
| 5783 | + | |
5778 | 5784 |
| |
5779 | 5785 |
| |
5780 | 5786 |
| |
| |||
10554 | 10560 |
| |
10555 | 10561 |
| |
10556 | 10562 |
| |
10557 |
| - | |
10558 |
| - | |
| 10563 | + | |
10559 | 10564 |
| |
10560 | 10565 |
| |
10561 | 10566 |
| |
|
Lines changed: 50 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
410 | 410 |
| |
411 | 411 |
| |
412 | 412 |
| |
413 |
| - | |
| 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 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
414 | 463 |
| |
415 | 464 |
| |
416 | 465 |
| |
|
Lines changed: 14 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
144 | 144 |
| |
145 | 145 |
| |
146 | 146 |
| |
147 |
| - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
148 | 161 |
| |
149 | 162 |
| |
150 | 163 |
| |
|
0 commit comments
Comments
(0)