1

I wonder if Postgres support the DENY command. I search in the documentation but I couldn't find anything about deny.

I have GRANT ALL ON table1 TO user1 WITH GRANT OPTION but I don't want user1 to be able to grant insert/update/delete to user2. (He can do whatever he want with everyone else!!!)

I want to use this command DENY INSERT,UPDATE,DELETE ON table1 TO user2;

Is there any way to accomplish this?

2
  • 1
    I think you need to grant each privilege separately. grant select on table1 to user1 with grant option; grant insert,update,delete on table1 to user1;
    – user1822
    Commented Nov 15, 2015 at 6:49
  • Maybe i wasn't clear enough. I want user1 to be able to grant everything he wants to everyone except user2. That's why i am trying to use the DENY command.
    – DeviLFisH
    Commented Nov 15, 2015 at 7:00

2 Answers 2

3

PostgreSQL does not have DENY ACLs.

Instead you must REVOKE any rights you want them to be missing, leaving only the rights you want.

e.g.

REVOKE ALL ON TABLE blah FROM USER fred;
GRANT SELECT ON TABLE blah TO USER Fred;
0

grant everything he wants to everyone except user2

it is will not work, GRANT option or present or not and not have target USER options

3
  • Sry but i can't undestand what you mean, can you rephrase your answer?
    – DeviLFisH
    Commented Nov 15, 2015 at 8:17
  • 2
    If You GRANT any options for user, You can not restrict for whom he can GRANT You can restrict WHAT he can GRANT (INSERT, SELECT ... ) but not TO WHOM
    – a_vlad
    Commented Nov 15, 2015 at 8:27
  • Yes i know. That's why i am trying to use the DENY example: DENY INSERT,UPDATE,DELETE ON table1 TO user2; But because postgreSQL, as i can see, doesn't support DENY and i am trying to find another way to do that!
    – DeviLFisH
    Commented Nov 15, 2015 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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