From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | charlie(at)torqinterface(dot)com |
Subject: | BUG #16388: Different results when bitmap scan enabled/disabled |
Date: | 2020-04-24 20:06:41 |
Message-ID: | 16388-98cffba38d0b7e6e@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 16388
Logged by: Charles Offenbacher
Email address: charlie(at)torqinterface(dot)com
PostgreSQL version: 11.7
Operating system: Ubuntu
Description:
Hi pgsql-bugs,
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? Simply enabling / disabling bitmapscan
changes the query results, which feels like a bug to me. Are there any
workarounds? I found one for my repro below (using NOT) but for some of the
complicated tsquery queries that I have in production, I'm not sure I can
make that work.
CREATE TABLE examples (content text);
CREATE INDEX ts_idx ON examples USING gin(to_tsvector('simple', content));
INSERT INTO examples VALUES ('Example with a word');
/* Incorrectly returns no results */
SET enable_seqscan = OFF;
SET enable_indexscan = OFF;
SET enable_bitmapscan = ON;
SELECT * FROM examples
WHERE to_tsvector('simple', content) @@ to_tsquery('simple',
'!(example<->word)')
/* Correctly returns results */
SET enable_seqscan = OFF;
SET enable_indexscan = OFF;
SET enable_bitmapscan = OFF; /* disabled */
SELECT * FROM examples
WHERE to_tsvector('simple', content) @@ to_tsquery('simple',
'!(example<->word)')
/* Also correctly returns results by using index and NOT keyword */
SET enable_seqscan = OFF;
SET enable_indexscan = OFF;
SET enable_bitmapscan = ON; /* enabled */
SELECT * FROM examples
WHERE NOT to_tsvector('simple', content) @@ to_tsquery('simple',
'(example<->word)')
Thanks for your time, and any thoughts that you might have to spare.
-Charlie
From | Date | Subject | |
---|---|---|---|
Next Message | reda kodi | 2020-04-24 20:58:44 | problem |
Previous Message | cbw | 2020-04-24 16:35:39 | Re: Backend stuck in tirigger.c:afterTriggerInvokeEvents forever |