public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dominique Devienne <[email protected]>
To: Pavel Stehule <[email protected]>
Cc: [email protected]
Subject: Re: CALL and named parameters
Date: Thu, 7 Aug 2025 14:44:51 +0200
Message-ID: <CAFCRh-9XkFS==OwSB6jgY84L5d4PkV_Y9MxLgk=NVx0Z8W3o_A@mail.gmail.com> (raw)
In-Reply-To: <CAFj8pRCyW4E5OnZDGvk_YnPqaS_PfK-VKJOKGndC-gtAtDOtBw@mail.gmail.com>
References: <CAFCRh-_iLoUtMAtyunw_-O6sgpWo04sOmB38MUVNpuQVSkL_0Q@mail.gmail.com>
<CAFj8pRCyW4E5OnZDGvk_YnPqaS_PfK-VKJOKGndC-gtAtDOtBw@mail.gmail.com>
On Wed, Aug 6, 2025 at 8:09 PM Pavel Stehule <[email protected]> wrote:
> Maybe there is another issue?
Indeed. Thanks Pavel, Andrian, Christoph, for demonstrating I was wrong.
I misinterpreted the signals I got, and accepted the AI's interpretation on
success (after a long day) when the inderlying isse was elsewhere.
My mistake was in
> I verify the names of the parameters, in my CALL with named arguments. OK.
I verified against the embedded PL/pgSQL in my code, not what was in the DB.
I had renamed an argument in the code, but the schema was instantiated
using the earlier code.
And because I was using the named-argument syntax, but a wrong
arg-name, it fails.
What's not nice is in the way it failed IMHO. I guess I persist it's
not a user friendly message :)
Can you overload a function solely by changing an argument name?
If not, as I suspect, then function lookup doesn't strictly depend on
argument names (like in C++).
So the function did exist, with the correct "signature" (ignoring
argument names).
And I was "just" using the wrong arg-name. That tripped me up.
The AI's suggestion, to go positional, while based on crap reasoning,
did help me, in a way :).
So mea culpa. Apologies for the misguided rant (and smaller re-rant above :)).
PS: below's my psql session that led me to the wrong conclusion.
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'...
^
HINT: No procedure matches the given name and argument types. You
might need to add explicit type casts.
dd_v185=> call "Epos-DBA".db_grant_connect_to(grantee_role => 'dd_joe'::name);
ERROR: procedure Epos-DBA.db_grant_connect_to(grantee_role => name)
does not exist
LINE 1: call "Epos-DBA".db_grant_connect_to(grantee_role => 'dd_joe'...
^
HINT: No procedure matches the given name and argument types. You
might need to add explicit type casts.
dd_v185=> \df "Epos-DBA".db_grant_connect_to
List of functions
Schema | Name | Result data type | Argument data types | Type
----------+---------------------+------------------+---------------------+------
Epos-DBA | db_grant_connect_to | | IN login_role name | proc
(1 row)
dd_v185=> select has_schema_privilege('Epos-DBA', 'usage');
has_schema_privilege
----------------------
t
(1 row)
dd_v185=> select
has_function_privilege('"Epos-DBA".db_grant_connect_to(name)',
'execute');
has_function_privilege
------------------------
t
(1 row)
dd_v185=> call "Epos-DBA".db_grant_connect_to('dd_joe');
CALL
view thread (10+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: CALL and named parameters
In-Reply-To: <CAFCRh-9XkFS==OwSB6jgY84L5d4PkV_Y9MxLgk=NVx0Z8W3o_A@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox