Thread: Query a role's permission on a function

Query a role's permission on a function

From
Kevin Tu
Date:
Hi team, 

This sounds easy enough, but I can't quite figure out searching around. Can anybody please tell me which catalog table to query to find out whether a role/user has execute permission on a function?  

Thanks in advance,
 
Kevin Tu

Re: Query a role's permission on a function

From
Chandra Juthuga
Date:
Try this :- 
SELECT proacl 
FROM pg_proc 
WHERE proname='<Name of function>';
Regards
Chandra 


From: Kevin Tu <kevintu888@gmail.com>
Sent: 06 December 2021 20:34
To: pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Query a role's permission on a function
 
Hi team, 

This sounds easy enough, but I can't quite figure out searching around. Can anybody please tell me which catalog table to query to find out whether a role/user has execute permission on a function?  

Thanks in advance,
 
Kevin Tu

Re: Query a role's permission on a function

From
Tom Lane
Date:
Kevin Tu <kevintu888@gmail.com> writes:
> This sounds easy enough, but I can't quite figure out searching around. Can
> anybody please tell me which catalog table to query to find out whether a
> role/user has execute permission on a function?

I'd suggest using has_function_privilege() instead of trying to duplicate
the logic for yourself.

https://www.postgresql.org/docs/current/functions-info.html

            regards, tom lane