8.28. REVOKE

Synopsis

  1. REVOKE [ GRANT OPTION FOR ]
  2. ( privilege [, ...] | ALL PRIVILEGES )
  3. ON [ TABLE ] table_name FROM ( user | USER user | ROLE role )

Description

Revokes the specified privileges from the specified grantee.

Specifying ALL PRIVILEGES revokes DELETE, INSERT and SELECT privileges.

Specifying ROLE PUBLIC revokes privileges from the PUBLIC role. Users will retain privileges assigned to them directly or via other roles.

The optional GRANT OPTION FOR clause also revokes the privileges to grant the specified privileges.

For REVOKE statement to succeed, the user executing it should possess the specified privileges as well as the GRANT OPTION for those privileges.

Examples

Revoke INSERT and SELECT privileges on the table orders from user alice:

  1. REVOKE INSERT, SELECT ON orders FROM alice;

Revoke SELECT privilege on the table nation from everyone, additionally revoking the privilege to grant SELECT privilege:

  1. REVOKE GRANT OPTION FOR SELECT ON nation FROM ROLE PUBLIC;

Revoke all privileges on the table test from user alice:

  1. REVOKE ALL PRIVILEGES ON test FROM alice;

Limitations

Some connectors have no support for REVOKE.See connector documentation for more details.

See Also

GRANTSHOW GRANTS