Re: CALL and named parameters

From: Dominique Devienne <ddevienne(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: CALL and named parameters
Date: 2025-08-07 14:39:03
Message-ID: CAFCRh-_FCJNJ3hzutzzFkOSc_zs_rrCG90iFtjUbPt32Y6sVHw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Aug 7, 2025 at 4:36 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Dominique Devienne <ddevienne(at)gmail(dot)com> writes:
> > I was expecting an error telling me the procedure exists, but the
> > argument name used in the call didn't. Then it's obvious to me what
> > mistake I made. If argument names don't participate in the function's
> > signature, why should they participate in the lookup? Do the lookup
> > based on name and arg types (and count), that gives you a possible
> > overload set, which in my second attempt (with a ::name cast) WAS AN
> > EXACT MATCH for the signature, then give me an error about the
> > argument name, that does NOT tell me the function doesn't exist.
> > That's what I would expect.
>
> Criticism in the form of a patch is welcome ;-). The problem here
> is that the matching rules are far more complicated than you seem
> to think. It's not clear to me that we can definitively say that
> "we would have had a match except the argument name was wrong".
> If it is possible to know that, it's quite a few subroutines below
> where the error is actually issued (see ParseFuncOrColumn ->
> func_get_detail -> FuncnameGetCandidates -> MatchNamedCall).
> Maybe there's some fairly painless change that could be made in
> that rat's nest, but I lack enough caffeine to see it.

How about listing those "candidates" considered? In the detailed message?
With arg names. Then it would have been obvious(er), I'm arguing. --DD

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2025-08-07 14:42:15 Re: CALL and named parameters
Previous Message Tom Lane 2025-08-07 14:36:01 Re: CALL and named parameters