Re: CALL and named parameters

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dominique Devienne <ddevienne(at)gmail(dot)com>
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:36:01
Message-ID: 1568931.1754577361@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dominique Devienne 2025-08-07 14:39:03 Re: CALL and named parameters
Previous Message Dominique Devienne 2025-08-07 14:26:34 Re: CALL and named parameters