1

I am using the has_function_privilege, to check and see if a certain user can access a function in my database. However, if I use REVOKE to revoke access, has_function_privilege still returns true:

db=> revoke execute on function getid(text,text)  from user1;
REVOKE
db=> select has_function_privilege('user1', 'getid(text, text)', 'execute');
 has_function_privilege 
------------------------
 t
(1 row)

I am using PostgreSQL 9.2.3 on Windows 7.

2

This is probably because public has execute privilege on your function (it's the default).

Try this:

revoke execute on function getid(text,text)  from public;

and recheck the result of has_function_privilege.

For public to not get this privilege on newly created functions, you may change the default with:

ALTER default privileges revoke execute on functions from public;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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