PostgreSQL – How to DENY Insert, Update, Delete to User

permissionspostgresql

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?

Best Answer

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;