Re: CALL and named parameters - Mailing list pgsql-general

From Pavel Stehule
Subject Re: CALL and named parameters
Date
Msg-id CAFj8pRCyW4E5OnZDGvk_YnPqaS_PfK-VKJOKGndC-gtAtDOtBw@mail.gmail.com
Whole thread Raw
In response to CALL and named parameters  (Dominique Devienne <ddevienne@gmail.com>)
Responses Re: CALL and named parameters
List pgsql-general
Hi

st 6. 8. 2025 v 19:49 odesílatel Dominique Devienne <ddevienne@gmail.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

 

pgsql-general by date:

Previous
From: Dominique Devienne
Date:
Subject: CALL and named parameters
Next
From: Adrian Klaver
Date:
Subject: Re: CALL and named parameters