Re: CALL and named parameters

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: CALL and named parameters
Дата
Msg-id CAFj8pRCyW4E5OnZDGvk_YnPqaS_PfK-VKJOKGndC-gtAtDOtBw@mail.gmail.com
обсуждение исходный текст
Ответ на CALL and named parameters  (Dominique Devienne <ddevienne@gmail.com>)
Ответы Re: CALL and named parameters
Список 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 по дате отправления: