How can I query the access right privileges for a function?
I want to generate a GRANT EXECUTE script for all the functions in the database.
I am using PostgreSQL 8.3.
How can I query the access right privileges for a function?
I want to generate a GRANT EXECUTE script for all the functions in the database.
I am using PostgreSQL 8.3.
Laurenz Albe
On
You can query the system catalogs:
SELECT f.proname AS name,
f.proargtypes AS signature,
f.proacl AS permissions
FROM pg_catalog.pg_proc AS f
JOIN pg_catalog.pg_namespace AS s
ON f.pronamespace = s.oid
WHERE f.proname = 'myfunction'
AND s.nspname = 'myschema';
You know that PUBLIC has the EXECUTE privilege on functions by default, right?
Copyright © 2021 Jogjafile Inc.
I created a function (function chain exactly) to generate the scripts of function (functrion stub, drop script, create script, owner script, grant rights script). We are using dbeaver (I am not sure about other tools) and from the grid results we can copy paste the function definition. The resulting function can also be used to backup function definitions to a table etc. Let me know if you run into issues to it (we are running postgre 8.3 and this works for our functions).