REVOKE removes previously granted privileges from a role or public on database objects.
REVOKE removes one or more privileges that were granted with GRANT.Use it to tighten security when users no longer need access.
Revoke privileges when an employee leaves, a service account is retired, or a role should be read-only instead of read/write.
REVOKE privilege_list ON object FROM role_list [CASCADE | RESTRICT];
Use REVOKE SELECT, INSERT, UPDATE, DELETE ON table_name FROM role;
REVOKE USAGE, CREATE ON SCHEMA schema_name FROM role;
REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM role;
Yes.Replace role_list with PUBLIC to remove default privileges from every role.
1. Revoke write operations
2. Keep SELECT for analytics tools
REVOKE INSERT, UPDATE, DELETE ON Orders FROM reporting_role;
REVOKE INSERT, UPDATE, DELETE ON OrderItems FROM reporting_role;
1. Audit existing grants before revoking.
2. Combine REVOKE with ALTER DEFAULT PRIVILEGES to stop future grants.
3. Use CASCADE only when you understand dependent objects.
1. Forgetting to revoke sequence privileges required for INSERT.
2.Omitting REVOKE on views that expose the same data.
No. Use ALTER OBJECT OWNER instead.
Nothing changes; REVOKE is harmless in this case.
SET ROLE target_role; attempt the operation; RESET ROLE.
.
Yes. Use ALTER DEFAULT PRIVILEGES REVOKE ... to prevent automatic grants on newly created tables.
Privileges are re-evaluated on each statement, so the change is immediate—even for active sessions.