From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Nathan Bossart <nathandbossart@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: postgres_fdw hint messages
Date: Tue, 13 Sep 2022 08:32:43 +0200
Message-ID: <0fc339d4-3388-3849-4507-ef0fe0c783fa@enterprisedb.com> (raw)
In-Reply-To: <20220903043058.GA1264318@nathanxps13>
References: <b1f9f399-3a1a-b554-283f-4ae7f34608e2@enterprisedb.com>
<CA+TgmoY+BuSZm-Fbxx5zC6SuML=2F9YvaYuzVAJ=XyE65BnchQ@mail.gmail.com>
<1929340.1661531738@sss.pgh.pa.us>
<20220901223128.GA932597@nathanxps13>
<789102.1662073729@sss.pgh.pa.us>
<20220901233120.GA934376@nathanxps13>
<20220902212609.GA1216541@nathanxps13>
<YxKn9El8Km/3IZuI@paquier.xyz>
<1267654.1662170814@sss.pgh.pa.us>
<20220903043058.GA1264318@nathanxps13>
On 03.09.22 06:30, Nathan Bossart wrote:
> On Fri, Sep 02, 2022 at 10:06:54PM -0400, Tom Lane wrote:
>> I think the distance limit of 5 is too loose though. I see that
>> it accommodates examples like "passfile" for "password", which
>> seems great at first glance; but it also allows fundamentally
>> silly suggestions like "user" for "server" or "host" for "foo".
>> We'd need something smarter than Levenshtein if we want to offer
>> "passfile" for "password" without looking stupid on a whole lot
>> of other cases --- those words seem close, but they are close
>> semantically not textually.
>
> Yeah, it's really only useful for simple misspellings, but IMO even that is
> rather handy.
>
> I noticed that the parse_relation.c stuff excludes matches where more than
> half the characters are different, so I added that here and lowered the
> distance limit to 4. This seems to prevent the silly suggestions (e.g.,
> "host" for "foo") while retaining the more believable ones (e.g.,
> "passfile" for "password"), at least for the small set of examples covered
> in the tests.
I think this code is compact enough and the hints it produces are
reasonable, so I think we could go with it.
I notice that for column misspellings, the hint is phrased "Perhaps you
meant X." whereas here we have "Did you mean X?". Let's make that uniform.
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-hackers@postgresql.org
Cc: peter.eisentraut@enterprisedb.com, nathandbossart@gmail.com, tgl@sss.pgh.pa.us, michael@paquier.xyz, robertmhaas@gmail.com
Subject: Re: postgres_fdw hint messages
In-Reply-To: <0fc339d4-3388-3849-4507-ef0fe0c783fa@enterprisedb.com>
* 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