Re: bug: fuzzystrmatch levenshtein is wrong - Mailing list pgsql-hackers

From Robert Haas
Subject Re: bug: fuzzystrmatch levenshtein is wrong
Date
Msg-id 603c8f070912081804y16268436t3e1b12d7d2ac4bf4@mail.gmail.com
Whole thread Raw
In response to bug: fuzzystrmatch levenshtein is wrong  (marcin mank <marcin.mank@gmail.com>)
Responses Re: bug: fuzzystrmatch levenshtein is wrong  (Bruce Momjian <bruce@momjian.us>)
List 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


pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Streaming replication, some small issues
Next
From: Bruce Momjian
Date:
Subject: Re: bug: fuzzystrmatch levenshtein is wrong