Re: BUG #16388: Different results when bitmap scan enabled/disabled
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-bugs@lists.postgresql.org
Cc: charlie@torqinterface.com
Date: 2020-04-25T22:14:33Z
Lists: pgsql-bugs
Attachments
- bug-16388-fix.patch (text/x-diff) patch
I wrote: > PG Bug reporting form <noreply@postgresql.org> writes: >> When Postgres uses a bitmap heap scan to evaluate a tsquery that includes !, >> it is giving me different (and incorrect) results compared to when it >> performs a seqscan. >> Can anybody shed some light on this? > It's a bug, without a doubt. Here's a proposed patch that fixes it as I suggested yesterday, by converting TS_execute and TS_phrase_execute to use honest ternary results instead of trying to get by with bool. There's also a minor bug fix in TS_execute_ternary; that doesn't show up with the one-row example Charles posted, but it does show up with larger indexes. I had worried that it might be necessary to change the exposed API of TS_execute(), but in the event it seems we need not. Possibly the most controversial aspect of this patch is that I changed the test data file tsearch.data, by attaching lexeme position info to a couple dozen rows. Without that, the test_tsvector test table is next to useless for testing phrase search, since it has no rows with position data. This does result in minor changes in one existing test case for ts_stat(), but I see little wrong with that. Also, the new test cases in tstypes.sql are mostly to ensure that this patch didn't cause any changes in the behavior of phrase match; they all pass on the existing code. (Charles, if you want to test this locally to verify it fixes your problem, the code changes should apply to v11; though there are a couple of hunks in the regression test files that will not apply because they change test stanzas that are new in HEAD.) regards, tom lane
Commits
-
Fix full text search to handle NOT above a phrase search correctly.
- e81e5741a6c5 13.0 landed
- 98a4d6950b24 11.8 landed
- 22dcb6c206ac 9.6.18 landed
- 18f7e856cde4 12.3 landed
- 072a863275e9 10.13 landed