HAS_FUNCTION_PRIVILEGE
Return true if the user has the specified privilege for the specified stored procedure.
HAS_FUNCTION_PRIVILEGE([role,] function, privilege)If the role name is omitted, the function returns results for the current user. In this context, function is the name of a stored procedure created with CREATE PROCEDURE.
The only valid privilege value is EXECUTE.
Note: This function cannot be used in a query that has a FROM clause (with table references).
For example:
premdb=# create procedure addteam(name varchar(30)) as
$$ begin
insert into team(name) values(name);
end;
$$ language plpgsql;
CREATE PROCEDURE
premdb=# select has_function_privilege('bobr','addteam(varchar)','execute');
has_function_privilege
------------------------
f
(1 row)
premdb=# grant execute on procedure addteam(varchar) to bobr;
GRANT
premdb=# select has_function_privilege('bobr','addteam(varchar)','execute');
has_function_privilege
------------------------
t
(1 row)Parent topic:System Functions