Re: bug: fuzzystrmatch levenshtein is wrong
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: marcin mank <marcin.mank@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2009-12-09T02:04:02Z
Lists: pgsql-hackers
On Mon, Dec 7, 2009 at 8:33 AM, marcin mank <marcin.mank@gmail.com> wrote:
> The current behavior of levenshtein(text,text,int,int,int) is wrong. Consider:
>
> leki_dev=# select levenshtein('','a',2,4,5);
> levenshtein
> -------------
> 1
> (1 row)
>
>
> leki_dev=# select levenshtein('a','',2,4,5);
> levenshtein
> -------------
> 1
> (1 row)
>
>
> leki_dev=# select levenshtein('aa','a',2,4,5);
> levenshtein
> -------------
> 1
> (1 row)
>
>
> leki_dev=# select levenshtein('a','aa',2,4,5);
> levenshtein
> -------------
> 1
> (1 row)
>
> versus (after patch)
>
> postgres=# select levenshtein('','a',2,4,5);
> levenshtein
> -------------
> 2
> (1 row)
>
> postgres=# select levenshtein('a','',2,4,5);
> levenshtein
> -------------
> 4
> (1 row)
>
> postgres=# select levenshtein('aa','a',2,4,5);
> levenshtein
> -------------
> 4
> (1 row)
>
> postgres=# select levenshtein('a','aa',2,4,5);
> levenshtein
> -------------
> 2
> (1 row)
>
> patch attached.
I cannot get this patch to apply for anything. All 4 hunks fail, both
on HEAD and on the the pre-8.4-pgindent version of fuzzystrmatch.c.
Either I'm doing something wrong here, or there's something wrong with
this patch file.
...Robert