pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: bjdev.gthb@laposte.net
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18654: From fuzzystrmatch, levenshtein function with costs parameters produce incorrect results
Date: Mon, 14 Oct 2024 12:01:03 -0400
Message-ID: <3737494.1728921663@sss.pgh.pa.us> (raw)
In-Reply-To: <18654-c09f568d3ba6dfcd@postgresql.org>
References: <18654-c09f568d3ba6dfcd@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> But if we use this function with parameters other than 1 (the default) the
> result is incorrect

> SELECT levenshtein('horses','shorse',1,1,1) => 2 (correct)

> SELECT levenshtein('horses','shorse',100,10,1) => 101 (INCORRECT)
> The correct result is 6 (all the letter have to be substitute and it's not
> possible to have a lower score with others operations)

Hmm, works for me:

u8=# create extension fuzzystrmatch;
CREATE EXTENSION
u8=# SELECT levenshtein('horses','shorse',1,1,1);
 levenshtein 
-------------
           2
(1 row)

u8=# SELECT levenshtein('horses','shorse',100,10,1);
 levenshtein 
-------------
           6
(1 row)

I confess bafflement about why you're getting wrong answers.
You seem to be using a slightly out of date Postgres, but
none of this code has changed meaningfully since about 2016.
Maybe you hit a compiler bug?  Where did you get this copy
of Postgres from --- or if you built it yourself, what build
options did you use?

			regards, tom lane





view thread (3+ messages)  latest in thread

Message-ID: <3737494.1728921663@sss.pgh.pa.us>
Permalink:  ../3737494.1728921663@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3737494.1728921663@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bjdev.gthb@laposte.net, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18654: From fuzzystrmatch, levenshtein function with costs parameters produce incorrect results
  In-Reply-To: <3737494.1728921663@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox