Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t11Z2-00ELFn-Q6 for pgsql-bugs@arkaria.postgresql.org; Wed, 16 Oct 2024 10:47:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t11Z0-001emy-HC for pgsql-bugs@arkaria.postgresql.org; Wed, 16 Oct 2024 10:47:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t10zR-001JOQ-K3 for pgsql-bugs@lists.postgresql.org; Wed, 16 Oct 2024 10:10:50 +0000 Received: from smtp-outgoing-2002.laposte.net ([160.92.124.109]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t10zO-001A86-9z for pgsql-bugs@lists.postgresql.org; Wed, 16 Oct 2024 10:10:48 +0000 X-mail-filterd: {"version":"1.8.0","queueID":"4XT6DK18Srz7t7L","contextId": "be859aaa-cbf3-4d3e-ae1f-3a1d14b1ffa6"} Received: from outgoing-mail.laposte.net (localhost.localdomain [127.0.0.1]) by mlpnf0102.laposte.net (SMTP Server) with ESMTP id 4XT6DK18Srz7t7L; Wed, 16 Oct 2024 12:10:41 +0200 (CEST) X-mail-filterd: {"version":"1.8.0","queueID":"4XT6DJ5dlbz7t7W","contextId": "f879a862-82f5-4712-a3cd-eeccfc4d0e30"} X-lpn-mailing: LEGIT X-lpn-spamrating: 40 X-lpn-spamlevel: not-spam Received: from wlpnf0212.sys.meshcore.net (wlpnf0212.sys.meshcore.net [81.80.43.240]) by mlpnf0102.laposte.net (SMTP Server) with ESMTPA id 4XT6DJ5dlbz7t7W; Wed, 16 Oct 2024 12:10:40 +0200 (CEST) Date: Wed, 16 Oct 2024 12:10:40 +0200 (CEST) From: bjdev.gthb@laposte.net Reply-To: bjdev.gthb@laposte.net To: Tom Lane Cc: pgsql-bugs@lists.postgresql.org Message-ID: <292395358.3411411.1729073440569@wlpnf0212.sys.meshcore.net> In-Reply-To: <3737494.1728921663@sss.pgh.pa.us> References: <18654-c09f568d3ba6dfcd@postgresql.org> <3737494.1728921663@sss.pgh.pa.us> Subject: Re: BUG #18654: From fuzzystrmatch, levenshtein function with costs parameters produce incorrect results MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3411410_2037470168.1729073440569" X-ORIGINATING-IP: 81.80.43.240 X-Wum-Nature: EMAIL-NATURE X-SAVECOPY: true X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-CC: |~| X-WUM-REPLYTO: |~| DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laposte.net; s=lpn-wlmd; t=1729073443; bh=p7VWrfwEJASBArFHSTqNBYaR0Ckt7h3wngNgLppy6SI=; h=Date:From:Reply-To:To:Cc:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type; b=aN4WD0lZrOP6a6DFgmEdDB+h7Q8sY99IU/VvRKlMYfzWNtGkhWpj+aV9edTY9hxYLpPqNLgn3loun+FA1ki8u3GWqvV+Vxb1ZvjtQ3DhdLPFrprvPERUgMXVOxrKs8od+HtclG5xcFMHclukbLCl4SQAw14cgyllJPnJYCLXib8G5Ve0ZZ9lWpSjo2qQPNEWg2coGxSfw3FnNFEC8dVWqfaJFwMn9CzyKHogM9NtiS5o3gBm6+NSW2pteqD/E+KxQfZVzEkRWAzi8MXFFJNosf4ZCLr8WHMWQJYBYrRzP0AH2hKdWCZjvbLG1vOwHZxCIeoZha493tNznTa0B+88WA==; List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------=_Part_3411410_2037470168.1729073440569 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Tom, Thank you for this feedback, Indeed, it works correctly. The problem comes from the other side of the keyboard... I went a little fast and did not check the length of my input strings which contained "invisible" characters. After cleaning up the results obtained are as expected. Really sorry for this false alarm Regards 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 ------=_Part_3411410_2037470168.1729073440569 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Tom,

Thank you for this feedback,
Indeed, it works correctly. The problem comes from the other side of the keyboard...
I went a little fast and did not check the length of my input strings which contained "invisible" characters.
After cleaning up the results obtained are as expected.
Really sorry for this false alarm

Regards
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
------=_Part_3411410_2037470168.1729073440569--