Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Given I am a root user X. I have users A and B.

How do I GRANT user A to enable him granting user B to execute a specific set of functions?

For example we have user A that owns database_1. User A creates some stored functions on this DB (say, function_a and function_b). User A should be able grant execution of that functions to user B, and only to him.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

By default, an object's owner has ALL PRIVILEGES on that object, but I don't recall specifically whether those privileges extend to allowing a normal (non-super) user to GRANT permissions on that object to other users.

In any case, you should be able to give that ability to a user by appending the WITH GRANT OPTION clause to a GRANT statement. (I refer you to the docs for full details.)

For example, in your hypothetical scenario, as superuser X, you could do something like this:

GRANT ALL PRIVILEGES  ON DATABASE database_1  TO A  WITH GRANT OPTION;

User A would then have the power to GRANT permissions on objects in database_1 to other users. Continuing the hypothetical example, user A could give specific permissions to user B, like this:

GRANT EXECUTE  ON FUNCTION function_a(), function_b()  TO B;
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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