Re: CALL and named parameters

Christoph Moench-Tegeder <cmt@burggraben.net>

From: Christoph Moench-Tegeder <cmt@burggraben.net>
To: Dominique Devienne <ddevienne@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, pgsql-general@lists.postgresql.org
Date: 2025-08-07T23:14:07Z
Lists: pgsql-general
## Dominique Devienne (ddevienne@gmail.com):

> dd_v185=> call "Epos-DBA".db_grant_connect_to(grantee_role => 'dd_joe');
> ERROR:  procedure Epos-DBA.db_grant_connect_to(grantee_role =>
> unknown) does not exist
> LINE 1: call "Epos-DBA".db_grant_connect_to(grantee_role => 'dd_joe'...

There's the problem: "unknown" type - consider that string there as
"too flexible", it can be coerced into too many types, so the error
says "unknown".
Consider this demonstration:

db=# call proc1(val => 1);
CALL
db=# call proc1(val => '2');
CALL
db=# call proc1(value => 3);
ERROR:  procedure proc1(value => integer) does not exist
LINE 1: call proc1(value => 3);
             ^
HINT:  No procedure matches the given name and argument types. You might need to add explicit type casts.
db=# call proc1(value => '4');
ERROR:  procedure proc1(value => unknown) does not exist
LINE 1: call proc1(value => '4');
             ^
HINT:  No procedure matches the given name and argument types. You might need to add explicit type casts.
db=# call proc1(value => text '5');
ERROR:  procedure proc1(value => text) does not exist
LINE 1: call proc1(value => text '5');
             ^
HINT:  No procedure matches the given name and argument types. You might need to add explicit type casts.

Regards,
Christoph

-- 
Spare Space