public inbox for [email protected]  
help / color / mirror / Atom feed
Need help understanding has_function_privilege
2+ messages / 2 participants
[nested] [flat]

* Need help understanding has_function_privilege
@ 2025-03-19 08:24  Cosimo Simeone <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Cosimo Simeone @ 2025-03-19 08:24 UTC (permalink / raw)
  To: [email protected]

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!


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Need help understanding has_function_privilege
@ 2025-03-20 13:28  Joe Conway <[email protected]>
  parent: Cosimo Simeone <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Joe Conway @ 2025-03-20 13:28 UTC (permalink / raw)
  To: Cosimo Simeone <[email protected]>; [email protected]

On 3/19/25 04:24, Cosimo Simeone wrote:
> 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;

See:

https://www.postgresql.org/docs/current/sql-createfunction.html#:~:text=execute%20privilege%20is%20g...

-- 
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-03-20 13:28 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-03-19 08:24 Need help understanding has_function_privilege Cosimo Simeone <[email protected]>
2025-03-20 13:28 ` Joe Conway <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox