forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit05d2497
committed
Improve similar_escape() in two different ways:
* Stop escaping ? and {. As of SQL:2008, SIMILAR TO is defined to havePOSIX-compatible interpretation of ? as well as {m,n} and related constructs,so we should allow these things through to our regex engine.* Escape ^ and $. It appears that our regex engine will treat ^^ at thebeginning of the string the same as ^, and similarly for $$ at the end ofthe string, which meant that SIMILAR TO was effectively ignoring ^ at thestart of the pattern and $ at the end. Since these are not supposed to bemetacharacters, this is a bug.The second part of this is arguably a back-patchable bug fix, but I'mhesitant to do that because it might break applications that are expectingsomething like "col SIMILAR TO '^foo$'" to work like a POSIX pattern.Seems safer to only change it at a major version boundary.Per discussion of an example from Doug Gorley.1 parent8a5849b commit05d2497
2 files changed
+32
-8
lines changedLines changed: 28 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| |||
3154 | 3154 |
| |
3155 | 3155 |
| |
3156 | 3156 |
| |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
3157 | 3182 |
| |
3158 | 3183 |
| |
3159 | 3184 |
| |
| |||
3168 | 3193 |
| |
3169 | 3194 |
| |
3170 | 3195 |
| |
3171 |
| - | |
3172 |
| - | |
3173 |
| - | |
| 3196 | + | |
| 3197 | + | |
3174 | 3198 |
| |
3175 | 3199 |
| |
3176 | 3200 |
| |
|
Lines changed: 4 additions & 4 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 |
| |
| |||
639 | 639 |
| |
640 | 640 |
| |
641 | 641 |
| |
642 |
| - | |
| 642 | + | |
643 | 643 |
| |
644 | 644 |
| |
645 | 645 |
| |
| |||
740 | 740 |
| |
741 | 741 |
| |
742 | 742 |
| |
743 |
| - | |
744 |
| - | |
| 743 | + | |
| 744 | + | |
745 | 745 |
| |
746 | 746 |
| |
747 | 747 |
| |
|
0 commit comments
Comments
(0)