]> granicus.if.org Git - postgresql/commit
Fix contrib/pg_trgm's similarity() function for trigram-free strings.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 13 Feb 2013 19:07:22 +0000 (14:07 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 13 Feb 2013 19:07:22 +0000 (14:07 -0500)
commit04d7fa5e31f094bd1d87e2da93ba1786a882884f
tree5a79ad66fbc550a86bcb5b1743c5db1e19ade970
parentae1525fdcba5aae4f0efa5ea9803e615644b3e71
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.
contrib/pg_trgm/expected/pg_trgm.out
contrib/pg_trgm/sql/pg_trgm.sql
contrib/pg_trgm/trgm_op.c