Re: postgres_fdw hint messages

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: postgres_fdw hint messages
Date: 2022-09-13 06:32:43
Message-ID: 0fc339d4-3388-3849-4507-ef0fe0c783fa@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2022-09-13 06:38:18 Re: Error "initial slot snapshot too large" in create replication slot
Previous Message Bharath Rupireddy 2022-09-13 06:26:16 Re: Assertion failure in WaitForWALToBecomeAvailable state machine