agora inbox for pgsql-bugs@postgresql.org
help / color / mirror / Atom feedFrom: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: charlie@torqinterface.com
Subject: BUG #16388: Different results when bitmap scan enabled/disabled
Date: Fri, 24 Apr 2020 20:06:41 +0000
Message-ID: <16388-98cffba38d0b7e6e@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 16388
Logged by: Charles Offenbacher
Email address: charlie@torqinterface.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
view thread (3+ messages) latest in thread
Message-ID: <16388-98cffba38d0b7e6e@postgresql.org>
Permalink: ../16388-98cffba38d0b7e6e@postgresql.org/
Also on: postgresql.org/message-id/16388-98cffba38d0b7e6e@postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, charlie@torqinterface.com
Subject: Re: BUG #16388: Different results when bitmap scan enabled/disabled
In-Reply-To: <16388-98cffba38d0b7e6e@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox