theory/pgtap

Function to check procedure privileges

hettie-d opened this issue · 3 comments

Is it possible to add a function to check procedure privileges similar to function_privileges_are?

Thanks!

theory commented

I'm sure it is, probably a straightforward refactoring of the function tests.

theory commented

Actually it looks like the existing function should work:

david=# CREATE PROCEDURE insert_data(a integer, b integer)
LANGUAGE SQL
AS $$
 
$$;
CREATE PROCEDURE

david=# select has_function_privilege('public', 'insert_data(integer, integer)', 'EXECUTE');
 has_function_privilege 
------------------------
 t
 
david=# select function_privs_are('public', 'insert_data', '{int, int}'::name[], current_user, '{EXECUTE}');
                                  function_privs_are                                  
--------------------------------------------------------------------------------------
 ok 1 - Role david should be granted EXECUTE on function public.insert_data(int, int)
(1 row)

It gave me an error: "function does not exist', but it could be a user error! I will double-check and report!