Re: CALL and named parameters

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Dominique Devienne <ddevienne(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: CALL and named parameters
Date: 2025-08-06 18:08:36
Message-ID: CAFj8pRCyW4E5OnZDGvk_YnPqaS_PfK-VKJOKGndC-gtAtDOtBw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

st 6. 8. 2025 v 19:49 odesílatel Dominique Devienne <ddevienne(at)gmail(dot)com>
napsal:

> (sorry, this is a rant...).
>
> Was getting an error calling a procedure
>
> ERROR: procedure ... does not exist
> HINT: No procedure matches the given name and argument types. You
> might need to add explicit type casts.
>
> I verify USAGE on the SCHEMA of the proc. OK.
> I verify EXECUTE on the FUNCTION. OK.
> I verify the names of the parameters, in my CALL with named arguments. OK.
>
> Turns out, thanks to ChatGPT for clueing me in, CALL does NOT support
> named parameters. And it's about the least helpful error message
> PostgreSQL could have provided IMO. I'd expect something much better
> in this specific case, FWIW.
>
> That's two unhelpful error messages in a short time :).
>
> Thanks, and again sorry for the rant. Wasted time on this. --DD
>

I think so ChatGPT is wrong

(2025-08-06 20:04:34) postgres=# create or replace procedure foo(a int, b
numeric)
postgres-# as $$ begin
postgres$# raise notice 'a: %, b: %', a, b;
postgres$# end;
postgres$# $$ language plpgsql;
CREATE PROCEDURE
(2025-08-06 20:05:15) postgres=# call foo(10,20);
NOTICE: a: 10, b: 20
CALL
(2025-08-06 20:05:20) postgres=# call foo(10,b=>20);
NOTICE: a: 10, b: 20
CALL
(2025-08-06 20:05:26) postgres=# call foo(a=>10,b=>20);
NOTICE: a: 10, b: 20
CALL
(2025-08-06 20:05:33) postgres=# create or replace procedure foo1(a int, b
numeric default 0.0)
as $$ begin
raise notice 'a: %, b: %', a, b;
end;
$$ language plpgsql;
CREATE PROCEDURE
(2025-08-06 20:05:49) postgres=# call foo1(a=>10);
NOTICE: a: 10, b: 0.0
CALL
(2025-08-06 20:05:57) postgres=# call foo(b=>20, a=>10);
NOTICE: a: 10, b: 20
CALL
(2025-08-06 20:06:13) postgres=#

Maybe there is another issue?

Can you send an example?

Regards

Pavel

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2025-08-06 18:10:55 Re: CALL and named parameters
Previous Message Dominique Devienne 2025-08-06 17:48:30 CALL and named parameters