I have a user group named editor_users
in my PostgreSQL 9.5 database. And my product table is granted select, insert, update and delete
to editor_user
members.
But I want to prevent my id column. Nobody may not update id column. How can I revoke update privileges from users?
You could give privileges for every column. Assuming you have a table like the following:
CREATE TABLE product (
id serial primary key,
mytext text
);
You can grant privileges to editor_user
like that:
GRANT SELECT(id), INSERT(id) ON product TO editor_user;
GRANT SELECT(mytext), UPDATE(mytext), INSERT(mytext), REFERENCES(mytext) ON product TO editor_user;