pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #14563: count(*) gives a wrong result in PostgreSQL for some regex with pg_trm/GIN index
2+ messages / 2 participants
[nested] [flat]
Commits from this thread:
2017-02-22 16500d2278 513c9f9de2 98755681a2 53b5a8c131 9e43e8714c Fix contrib/pg_trgm's extraction of trigrams from regular expressions.
* BUG #14563: count(*) gives a wrong result in PostgreSQL for some regex with pg_trm/GIN index
@ 2017-02-22 11:14 isayko.alexey@gmail.com
2017-02-22 15:16 ` Re: BUG #14563: count(*) gives a wrong result in PostgreSQL for some regex with pg_trm/GIN index Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: isayko.alexey@gmail.com @ 2017-02-22 11:14 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 14563
Logged by: Alexey Isayko
Email address: isayko.alexey@gmail.com
PostgreSQL version: 9.6.1
Operating system: Windows 10.0.14393 x64
Description:
When using some RE to filter rows on gin-indexed column with pg_trm,
count(*) could give a wrong result (zero instead of real count):
CREATE EXTENSION pg_trgm;
CREATE TABLE t (
s text
);
CREATE INDEX ON t USING gin (s gin_trgm_ops);
INSERT INTO t VALUES ('12-34');
SET enable_seqscan = OFF; -- to force using the index on our small table
SELECT count(*) FROM t WHERE s~'\d{2}[-]?\d{2}'; -- gives me 0 and it's
wrong
But if we will turn on seq scans, we will get the correct result:
SET enable_seqscan = ON;
SELECT count(*) FROM t WHERE s~'\d{2}[-]?\d{2}'; -- gives me 1 and it's
correct
Same behaviour I get with 9.5.4 (windows and linux) and 9.6.1 (windows)
versions of the PostgreSQL
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #14563: count(*) gives a wrong result in PostgreSQL for some regex with pg_trm/GIN index
2017-02-22 11:14 BUG #14563: count(*) gives a wrong result in PostgreSQL for some regex with pg_trm/GIN index isayko.alexey@gmail.com
@ 2017-02-22 15:16 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2017-02-22 15:16 UTC (permalink / raw)
To: isayko.alexey@gmail.com; +Cc: pgsql-bugs
isayko.alexey@gmail.com writes:
> When using some RE to filter rows on gin-indexed column with pg_trm,
> count(*) could give a wrong result (zero instead of real count):
Duplicated that here, will look into it. Thanks for the report!
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2017-02-22 15:16 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-02-22 11:14 BUG #14563: count(*) gives a wrong result in PostgreSQL for some regex with pg_trm/GIN index isayko.alexey@gmail.com
2017-02-22 15:16 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox