Using postgresql 9.6
I enabled pgcrypto using create extension pgcrypto using the postgres user. Now i want to grant execute rights to my other db user. Unfortunately i am not able to do it. Is this possible or do you have to be a superuser to use the digest function from pgcrypto.
postgres=# GRANT EXECUTE ON FUNCTION digest TO another_user;
ERROR: syntax error at or near "digest"
LINE 1: GRANT EXECUTE ON FUNCTION digest TO another_user;
Using the answer below, I was able to successfully grant permission to execute the function. However another_user cannot execute the function. Are there other permissions that i need in order to execute this function using another_user?
another_user=> SELECT digest('whatisgoingon'::text, 'sha256'::text);
ERROR: function digest(text, text) does not exist
LINE 1: SELECT digest('whatisgoingon'::text, 'sha256'::text);
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
Even though when i check permissions for the user i get back that i have permissions.
postgres=# select has_function_privilege('another_user', 'digest(text, text)', 'execute');
has_function_privilege
------------------------
t
(1 row)
Thanks