Reputation: 441
I have a table like:
CREATE TABLE public.pagos
(
condominio character varying(12) NOT NULL,
id_unidad character varying(10) NOT NULL,
fechapago date NOT NULL,
montopago integer NOT NULL
)
A user:
CREATE USER user1 WITH PASSWORD 'user1';
I give permissions to it user:
GRANT SELECT ON pagos TO user1;
How I can Revoke all permissions (in this case only select) of user1 in a specific field of the table (like the montopago field) ?
Thanks !
Upvotes: 2
Views: 363
Reputation: 246798
Permissions in SQL are additive, so you can never make exceptions of the kind "grant select on the whole table, but revoke it from one specific column". What you need to do is to revoke the permission you granted on the whole table and grant column permissions instead:
REVOKE SELECT ON pagos FROM user1;
GRANT SELECT (condominio, id_unidad, fechapago) ON pagos TO user1;
Upvotes: 2