pgsql: Fix contrib/pg_trgm's similarity() function for trigram-free str

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix contrib/pg_trgm's similarity() function for trigram-free str
Date: 2013-02-13 19:07:56
Message-ID: E1U5hgS-0005bq-Sp@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix contrib/pg_trgm's similarity() function for trigram-free strings.

Cases such as similarity('', '') produced a NaN result due to computing
0/0. Per discussion, make it return zero instead.

This appears to be the basic cause of bug #7867 from Michele Baravalle,
although it remains unclear why her installation doesn't think Cyrillic
letters are letters.

Back-patch to all active branches.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/f73a16340c3eba317ab433466b9ad9eb2f962020

Modified Files
--------------
contrib/pg_trgm/expected/pg_trgm.out | 6 ++++++
contrib/pg_trgm/sql/pg_trgm.sql | 2 ++
contrib/pg_trgm/trgm_op.c | 8 ++++++--
3 files changed, 14 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-02-13 21:20:13 pgsql: Fix CVE-2013-0255 properly.
Previous Message Tom Lane 2013-02-13 17:48:45 pgsql: Fix bogus when-to-deregister-from-listener-array logic.