- Notifications
You must be signed in to change notification settings - Fork5
Commit9f1e642
committed
Fix incorrect handling of lookahead constraints in pg_regprefix().
pg_regprefix was doing nothing with lookahead constraints, which wouldbe fine if it were the right kind of nothing, but it isn't: we have toterminate our search for a fixed prefix, not just pretend the LACON arcisn't there. Otherwise, if the current state has both a LACON outarc and asingle plain-color outarc, we'd falsely conclude that the color representsan addition to the fixed prefix, and generate an extracted index conditionthat restricts the indexscan too much. (See added regression test case.)Terminating the search is conservative: we could traverse the LACON arc(thus assuming that the constraint can be satisfied at runtime) and thenexamine the outarcs of the linked-to state. But that would be a lot morework than it seems worth, because writing a LACON followed by a singleplain character is a pretty silly thing to do.This makes a difference only in rather contrived cases, but it's a bug,so back-patch to all supported branches.1 parentee7ca55 commit9f1e642
File tree
3 files changed
+13
-6
lines changed- src
- backend/regex
- test/regress
- expected
- sql
3 files changed
+13
-6
lines changedLines changed: 4 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
162 | 162 |
| |
163 | 163 |
| |
164 | 164 |
| |
165 |
| - | |
166 |
| - | |
167 |
| - | |
168 |
| - | |
| 165 | + | |
169 | 166 |
| |
170 | 167 |
| |
171 |
| - | |
172 |
| - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
173 | 171 |
| |
174 | 172 |
| |
175 | 173 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
153 | 153 |
| |
154 | 154 |
| |
155 | 155 |
| |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
156 | 164 |
| |
157 | 165 |
| |
158 | 166 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
| 37 | + | |
37 | 38 |
| |
38 | 39 |
| |
39 | 40 |
| |
|
0 commit comments
Comments
(0)