On Thu, Sep 01, 2022 at 07:08:49PM -0400, Tom Lane wrote:
> (1) there probably needs to be some threshold of closeness, so we don't
> offer "foobar" when the user wrote "huh"
Agreed.
> (2) there are several places doing this now, and there will no doubt
> be more later, so we need to try to abstract the logic so it can be
> shared.
Will do.
I'm also considering checking whether the user-provided string is longer
than MAX_LEVENSHTEIN_STRLEN so that we can avoid the ERROR from
varstr_levenshtein(). Or perhaps varstr_levenshtein() could indicate that
the string is too long without ERROR-ing (e.g., by returning -1). If the
user-provided string is too long, we'd just omit the hint.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com