mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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.
This commit is contained in:
@ -11,6 +11,8 @@ select show_trgm('a b C0*%^');
|
||||
select similarity('wow','WOWa ');
|
||||
select similarity('wow',' WOW ');
|
||||
|
||||
select similarity('---', '####---');
|
||||
|
||||
CREATE TABLE test_trgm(t text);
|
||||
|
||||
\copy test_trgm from 'data/trgm.data
|
||||
|
Reference in New Issue
Block a user