From: Tom Lane <tgl@sss.pgh.pa.us>
To: contact@gregnavis.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14202: pg_trgm: % uses incorrect comparison of similarity with the limit
Date: Mon, 20 Jun 2016 10:15:17 -0400
Message-ID: <12708.1466432117@sss.pgh.pa.us> (raw)
In-Reply-To: <20160620115321.5792.10766@wrigleys.postgresql.org>
References: <20160620115321.5792.10766@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
contact@gregnavis.com writes:
> Due to a bug gtrgm_consistent, using a GiST or GIN trigram index can return
> extraneous rows whose trigram-similarity was below set_limit().
> ...
> The root cause is this line in contrib/pg_trgm/trgm_gist.c:
> /* strange bug at freebsd 5.2.1 and gcc 3.3.3 */
> res = (*(int *) &tmpsml == *(int *) &nlimit || tmpsml > nlimit);
> nlimit is of type double. tmpsml is of type float4.
Ugh, yeah, that's completely broken now isn't it.
I suspect that changing tmpsml to double would be enough to get around the
alleged gcc bug and let us write the comparison naturally, ie the whole
thing was likely an artifact of using float4. Will try it that way.
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
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, contact@gregnavis.com
Subject: Re: BUG #14202: pg_trgm: % uses incorrect comparison of similarity with the limit
In-Reply-To: <12708.1466432117@sss.pgh.pa.us>
References: <20160620115321.5792.10766@wrigleys.postgresql.org> <12708.1466432117@sss.pgh.pa.us>
* 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