REVOKE statement revokes privileges from users and/or roles. For the list of privileges that can be granted to and revoked from users and roles, see GRANT.
You can use REVOKE to directly revoke privileges from a role or user, or you can revoke membership to an existing role, which effectively revokes that role’s privileges.
Syntax
Parameters
Revoke all privileges.
A comma-separated list of privileges to revoke.Supported privileges include:
SELECT- Read data from a tableINSERT- Insert data into a tableUPDATE- Update data in a tableDELETE- Delete data from a tableCREATE- Create objects in a database or schemaDROP- Drop objects from a databaseGRANT- Grant privileges to other usersUSAGE- Use a schema or typeEXECUTE- Execute a functionZONECONFIG- Modify replication zonesCONNECT- Connect to a database
A comma-separated list of database, table, sequence, or function names. The list should be preceded by the object type (e.g.,
DATABASE mydatabase).Revoke privileges on all sequences in a schema or list of schemas.
Revoke privileges on all tables and sequences in a schema or list of schemas.
Revoke privileges on all user-defined functions in a schema or list of schemas.
A comma-separated list of roles.
Required privileges
-
To revoke privileges, user revoking privileges must have the
GRANTprivilege on the target database, schema, table, or user-defined type. In addition to theGRANTprivilege, the user revoking privileges must have the privilege being revoked on the target object. For example, a user revoking theSELECTprivilege on a table to another user must have theGRANTandSELECTprivileges on that table. -
To revoke role membership, the user revoking role membership must be a role admin (i.e., members with the
WITH ADMIN OPTION) or a member of theadminrole. To remove membership to theadminrole, the user must haveWITH ADMIN OPTIONon theadminrole.
Considerations
- The
rootuser cannot be revoked from theadminrole
Examples
Revoke privileges on databases
Any tables that previously inherited the database-level privileges retain the privileges.
Revoke privileges on specific tables
Revoke privileges on all tables in a schema
Revoke system-level privileges
Revoke role membership
Revoke the admin option
See also
- GRANT
- SHOW GRANTS
- CREATE ROLE
- ALTER ROLE
- DROP ROLE
- Privileges