public inbox for [email protected]  
help / color / mirror / Atom feed
From: Cosimo Simeone <[email protected]>
To: [email protected]
Subject: Need help understanding has_function_privilege
Date: Wed, 19 Mar 2025 08:24:03 +0000
Message-ID: <CAD1W9HXMUZ6mjBVhNQJGqLQkMnyQAc28OAqvCEpZ_rOEH=eDfw@mail.gmail.com> (raw)

Hi!
I'd need help understanding what i am doing wrong...

Where am I:
=# \c
psql (15.8 (Homebrew), server 14.15 (Debian 14.15-1.pgdg120+1))
You are now connected to database "postgres" as user "postgres".

Init:
=# create role my_user;
=# create schema my_schema;
=# create function my_schema.my_func(p1 text) returns integer as $$select
1::integer;$$ language sql;

It works...
=#  select my_schema.my_func('x');
 my_func
---------
       1

Now, the controversial part:
=# SELECT has_function_privilege('my_user', 'my_schema.my_func(text)',
'execute');
 has_function_privilege
------------------------
 t

true?
Well... Ok, "whatever"... I revoke it:
=# revoke execute on function my_schema.my_func(text) from my_user;
REVOKE

But still:
=# select has_function_privilege('my_user', 'my_schema.my_func(text)',
'execute');
 has_function_privilege
------------------------
 t

What am I doing wrong? :-)

Thanks for help!


view thread (2+ 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]
  Subject: Re: Need help understanding has_function_privilege
  In-Reply-To: <CAD1W9HXMUZ6mjBVhNQJGqLQkMnyQAc28OAqvCEpZ_rOEH=eDfw@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