0

I found how to list tables a role has permissions on. I found how to list all functions with arguments.

My question is: How to list all functions with arguments a role is allowed to execute?

1 Answer 1

2

You can use the has_function_privilege function for that:

SELECT p.pronamespace::regnamespace as schema,
       p.proname||'('||pg_get_function_arguments(p.oid)||')' as function
FROM pg_proc p 
WHERE has_function_privilege(p.oid, 'execute')
      AND p.pronamespace NOT IN ('pg_catalog'::regnamespace,
                                 'information_schema'::regnamespace)
2
  • 1
    Thank you. Now that I know (again) that I can use has_function_privilege, I just found another question asking the same: stackoverflow.com/questions/18769397/… Commented Apr 30, 2020 at 12:18
  • It works. Just two notes: 1) maybe the condition p.pronamespace <> 'information_schema'::regnamespace should be added to remove other general functions, and 2) there is an extra ; in your code after has_function_privilege(p.oid, 'execute') .
    – caprilo
    Commented Mar 24 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.