- Notifications
You must be signed in to change notification settings - Fork5
Commit7844608
committed
Get rid of USE_WIDE_UPPER_LOWER dependency in trigram construction.
contrib/pg_trgm's make_trigrams() was coded to ignore multibyte characterboundaries and just make trigrams from bytes if USE_WIDE_UPPER_LOWER wasn'tdefined. This is a bit odd, since there's no obvious reason why trigramcompaction rules should depend on the presence of towlower() and friends.What's more, there was an Assert() that would fail if that code path wasfed any multibyte characters.We need to do something about this since the pending regex-indexing patchhas an assumption that you get just one "trgm" from any three characters.The best solution seems to be to remove the USE_WIDE_UPPER_LOWERdependency, which shouldn't really have been there in the first place.The second loop in make_trigrams() is now just a fast path and not apotentially incompatible algorithm.If there is anybody still using Postgres on machines without wcstombs() ortowlower(), and they have non-ASCII data indexed by pg_trgm, they'll needto REINDEX those indexes after pg_upgrade to 9.3, else searches may failincorrectly. It seems likely that there are no such installations, though.In passing, rename cnt_trigram to compact_trigram, which seems to betterdescribe its functionality, and improve make_trigrams' test for whether ithas to use the slow path or not (per a suggestion from Alexander Korotkov).1 parentfaf4726 commit7844608
1 file changed
+10
-7
lines changedLines changed: 10 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
109 | 109 |
| |
110 | 110 |
| |
111 | 111 |
| |
112 |
| - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
113 | 117 |
| |
114 |
| - | |
| 118 | + | |
115 | 119 |
| |
116 | 120 |
| |
117 | 121 |
| |
| |||
131 | 135 |
| |
132 | 136 |
| |
133 | 137 |
| |
134 |
| - | |
135 | 138 |
| |
136 | 139 |
| |
137 | 140 |
| |
| |||
144 | 147 |
| |
145 | 148 |
| |
146 | 149 |
| |
147 |
| - | |
148 |
| - | |
| 150 | + | |
149 | 151 |
| |
| 152 | + | |
150 | 153 |
| |
151 | 154 |
| |
152 | 155 |
| |
153 | 156 |
| |
154 | 157 |
| |
155 | 158 |
| |
156 |
| - | |
| 159 | + | |
157 | 160 |
| |
158 | 161 |
| |
159 | 162 |
| |
| |||
164 | 167 |
| |
165 | 168 |
| |
166 | 169 |
| |
167 |
| - | |
168 | 170 |
| |
| 171 | + | |
169 | 172 |
| |
170 | 173 |
| |
171 | 174 |
| |
|
0 commit comments
Comments
(0)