I have a database which has over 1000 functions. I want to GRANT execution permission to certain users. I can\'t do it manually, therefore I want to get a list of functions and
You should use pg_get_function_arguments(func_oid). Dynamic GRANT must be executed in anonymous code block or function (change my_schema and my_username to actual values):
do $$
declare
funcdef text;
begin
for funcdef in
select format('%s.%s (%s)',
nspname, proname, pg_get_function_arguments(p.oid))
from pg_proc p
join pg_namespace n on pronamespace = n.oid
where nspname = 'my_schema'
and not proisagg
loop
execute format ('GRANT EXECUTE ON FUNCTION %s TO my_username', funcdef);
end loop;
end $$;