From: jeff.janes@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14623: pg_trgm doesn't correctly process some regexp with negative lookahead
Date: Thu, 13 Apr 2017 18:05:03 +0000
Message-ID: <20170413180503.25948.94871@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14623
Logged by: Jeff Janes
Email address: jeff.janes@gmail.com
PostgreSQL version: 9.6.2
Operating system: Linux
Description:
I'm reporting this bug based on
https://dba.stackexchange.com/questions/170669/postgres-function-index-doesnt-work-correctly-with-re...
This simplified case is easy to reproduce back to at least 9.4, and is still
present in 10dev HEAD. Matches are missed when using the trgm index, but
not when doing the full table scan.
create table foobar (x text);
insert into foobar values ('eldrazi scion'),('eldrazi scio');
create extension pg_trgm ;
create index on foobar using gin (x gin_trgm_ops);
select * from foobar where x ~ 'eldrazi (?!scion)'; -- returns 1 row
set enable_seqscan TO off;
select * from foobar where x ~ 'eldrazi (?!scion)'; -- returns 0 rows
Building a gist rather than gin index exhibits the same bug.
The trigrams seem to be extracted correctly, but the graph stuffed into
extra_data is not correct. Looking at /tmp/packed.dot, there are no arrays
pointing to the successful termination state s1. Instead, I get lead to a
dead-end state s7.
If I change the regexp to 'eldrazi (?!s)', then bug goes away, and
/tmp/packed.dot shows the correct graph pointing to s1.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: jeff.janes@gmail.com
Subject: Re: BUG #14623: pg_trgm doesn't correctly process some regexp with negative lookahead
In-Reply-To: <20170413180503.25948.94871@wrigleys.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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox