Re: contrib/levenshtein() has a bug?

From: Ben <bench(at)silentmedia(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: contrib/levenshtein() has a bug?
Date: 2006-09-28 21:24:43
Message-ID: Pine.LNX.4.64.0609281421510.21293@GRD.cube42.tai.silentmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

Ah, yes, you are correct.

Hm, it's too bad levenshtein() is ascii-only.

On Thu, 28 Sep 2006, Tom Lane wrote:

> Ben <bench(at)silentmedia(dot)com> writes:
>> The levenshtein function from contrib/fuzzystrmatch.sql has a max arg
>> length of 255. OK, that's cool. But check this out:
>
>> mbrainz_db=> select max(length(name)) from public.track;
>> max
>> -----
>> 255
>> (1 row)
>
>> mbrainz_db=> select levenshtein(name,'foo') from public.track;
>> ERROR: argument exceeds max length: 255
>
>> That seems odd.
>
> length() measures in characters whereas the limit in question is being
> enforced in bytes. You got any multibyte characters in there?
>
> (It looks to me like levenshtein() is utterly non-multibyte-aware,
> which is probably a bug in itself.)
>
> regards, tom lane
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jack Orenstein 2006-09-28 21:58:44 Row versions and indexes
Previous Message Geoffrey 2006-09-28 21:22:54 Re: continued segmentation fault

Browse pgsql-patches by date

  From Date Subject
Next Message David Wheeler 2006-09-28 22:07:39 Patch: Tie stats options to autovacuum in postgresql.conf
Previous Message David Fetter 2006-09-28 21:21:19 Re: [HACKERS] Numeric overflow problem + patch