Re: Identifying function-lookup failures due to argument name mismatches

Chao Li <li.evan.chao@gmail.com>

From: Chao Li <li.evan.chao@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org, Dominique Devienne <ddevienne@gmail.com>
Date: 2025-08-19T08:54:45Z
Lists: pgsql-hackers
Hi Tom,

> On Aug 8, 2025, at 09:29, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> Anyway, I'm not seriously proposing that this should be committed
> as-is.  I'm throwing it out there in case anyone else has a good
> idea or feels motivated to push on the problem some more.

Looks like you are looking for someone to work out a final patch. If that is true, I will be happy to work on this problem.

> I couldn't quite let go of this, and after some thought I hit on the
> idea of making FuncnameGetCandidates pass back a bitmask of flags
> showing how far the match succeeded.  This seems to work pretty
> nicely, allowing quite-detailed reports with only minimal added
> overhead or code restructuring.  There's probably room for further
> improvement, but it has less of a whiff of "quick single-purpose
> hack".  See draft commit message for more details.

I traced this problem today, and I agree that making FuncnameGetCandidates to pass out some information should be right direction to go.

When there are multiple matches, I think we can find the best match by considering argument names/types, default values. If there are still multiple best matches, I think we can prompt all matches to client.

--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/




Commits

  1. Provide more-specific error details/hints for function lookup failures.