- Notifications
You must be signed in to change notification settings - Fork28
Commit0d779d2
committed
Convert tsginidx.c's GIN indexing logic to fully ternary operation.
Commit 2f2007fbb did this partially, but there were two remainingwarts. checkcondition_gin handled some uncertain cases by settingthe out-of-band recheck flag, some by returning TS_MAYBE, and someby doing both. Meanwhile, TS_execute arbitrarily converted aTS_MAYBE result to TS_YES. Thus, if checkcondition_gin chose toonly return TS_MAYBE, the outcome would be TS_YES with no recheckflag, potentially resulting in wrong query outputs.The case where this'd happen is if there were GIN_MAYBE entriesin the indexscan results passed to gin_tsquery_[tri]consistent,which so far as I can see would only happen if the tidbitmap usedto accumulate indexscan results grew large enough to become lossy.I initially thought of fixing this by ensuring we always set therecheck flag as well as returning TS_MAYBE in uncertain cases.But that errs in the other direction, potentially forcing rechecksof rows that provably match the query (since the recheck flagremains set even if TS_execute later finds that the answer must beTS_YES). Instead, let's get rid of the out-of-band recheck flagaltogether and rely on returning TS_MAYBE. This requires exportinga version of TS_execute that will actually return the full ternaryresult of the evaluation ... but we likely should have done thatto start with.Unfortunately it doesn't seem practical to add a regression test casethat covers this: the amount of data needed to cause the GIN bitmap tobecome lossy results in a longer runtime than I think we want to havein the tests. (I'm wondering about allowing smaller work_mem settingsto ameliorate that, but it'd be a matter for a separate patch.)Per bug #16865 from Dimitri Nüscheler. Back-patch to v13 wherethe faulty commit came in.Discussion:https://postgr.es/m/16865-4ffdc3e682e6d75b@postgresql.org1 parent80dc07a commit0d779d2
File tree
3 files changed
+44
-28
lines changed- src
- backend/utils/adt
- include/tsearch
3 files changed
+44
-28
lines changedLines changed: 29 additions & 28 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
175 | 175 |
| |
176 | 176 |
| |
177 | 177 |
| |
178 |
| - | |
179 | 178 |
| |
180 | 179 |
| |
181 | 180 |
| |
| |||
186 | 185 |
| |
187 | 186 |
| |
188 | 187 |
| |
189 |
| - | |
190 |
| - | |
191 |
| - | |
192 |
| - | |
193 |
| - | |
194 |
| - | |
195 |
| - | |
| 188 | + | |
196 | 189 |
| |
197 | 190 |
| |
198 | 191 |
| |
199 | 192 |
| |
| 193 | + | |
| 194 | + | |
| 195 | + | |
200 | 196 |
| |
201 |
| - | |
202 |
| - | |
| 197 | + | |
| 198 | + | |
203 | 199 |
| |
204 |
| - | |
| 200 | + | |
205 | 201 |
| |
206 | 202 |
| |
207 |
| - | |
| 203 | + | |
208 | 204 |
| |
209 | 205 |
| |
210 | 206 |
| |
211 | 207 |
| |
212 | 208 |
| |
213 | 209 |
| |
214 | 210 |
| |
215 |
| - | |
| 211 | + | |
216 | 212 |
| |
217 | 213 |
| |
218 | 214 |
| |
| |||
244 | 240 |
| |
245 | 241 |
| |
246 | 242 |
| |
247 |
| - | |
248 | 243 |
| |
249 |
| - | |
250 |
| - | |
251 |
| - | |
252 |
| - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
253 | 260 |
| |
254 | 261 |
| |
255 | 262 |
| |
| |||
266 | 273 |
| |
267 | 274 |
| |
268 | 275 |
| |
269 |
| - | |
270 |
| - | |
271 |
| - | |
272 |
| - | |
273 | 276 |
| |
274 | 277 |
| |
275 | 278 |
| |
| |||
282 | 285 |
| |
283 | 286 |
| |
284 | 287 |
| |
285 |
| - | |
286 | 288 |
| |
287 |
| - | |
288 |
| - | |
289 |
| - | |
290 |
| - | |
291 |
| - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
292 | 293 |
| |
293 | 294 |
| |
294 | 295 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1854 | 1854 |
| |
1855 | 1855 |
| |
1856 | 1856 |
| |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
1857 | 1869 |
| |
1858 | 1870 |
| |
1859 | 1871 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
199 | 199 |
| |
200 | 200 |
| |
201 | 201 |
| |
| 202 | + | |
| 203 | + | |
| 204 | + | |
202 | 205 |
| |
203 | 206 |
| |
204 | 207 |
| |
|
0 commit comments
Comments
(0)