Re: BUG #14202: pg_trgm: % uses incorrect comparison of similarity with the limit

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #14202: pg_trgm: % uses incorrect comparison of similarity with the limit
Дата
Msg-id 12708.1466432117@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #14202: pg_trgm: % uses incorrect comparison of similarity with the limit  (contact@gregnavis.com)
Список pgsql-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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: contact@gregnavis.com
Дата:
Сообщение: BUG #14202: pg_trgm: % uses incorrect comparison of similarity with the limit
Следующее
От: Jim Michaels
Дата:
Сообщение: about and feature matrix on site