REVOKE

Removes access privileges.

Synopsis

  1. REVOKE [GRANT OPTION FOR] { {SELECT | INSERT | UPDATE | DELETE
  2. | REFERENCES | TRUNCATE } [,...] | ALL [PRIVILEGES] }
  3. ON [TABLE] <tablename> [, ...]
  4. FROM {<rolename> | PUBLIC} [, ...]
  5. [CASCADE | RESTRICT]
  6. REVOKE [GRANT OPTION FOR] { {USAGE | SELECT | UPDATE} [,...]
  7. | ALL [PRIVILEGES] }
  8. ON SEQUENCE <sequencename> [, ...]
  9. FROM { <rolename> | PUBLIC } [, ...]
  10. [CASCADE | RESTRICT]
  11. REVOKE [GRANT OPTION FOR] { {CREATE | CONNECT
  12. | TEMPORARY | TEMP} [,...] | ALL [PRIVILEGES] }
  13. ON DATABASE <dbname> [, ...]
  14. FROM {<rolename> | PUBLIC} [, ...]
  15. [CASCADE | RESTRICT]
  16. REVOKE [GRANT OPTION FOR] {EXECUTE | ALL [PRIVILEGES]}
  17. ON FUNCTION <funcname> ( [[<argmode>] [<argname>] <argtype>
  18. [, ...]] ) [, ...]
  19. FROM {<rolename> | PUBLIC} [, ...]
  20. [CASCADE | RESTRICT]
  21. REVOKE [GRANT OPTION FOR] {USAGE | ALL [PRIVILEGES]}
  22. ON LANGUAGE <langname> [, ...]
  23. FROM {<rolename> | PUBLIC} [, ...]
  24. [ CASCADE | RESTRICT ]
  25. REVOKE [GRANT OPTION FOR] { {CREATE | USAGE} [,...]
  26. | ALL [PRIVILEGES] }
  27. ON SCHEMA <schemaname> [, ...]
  28. FROM {<rolename> | PUBLIC} [, ...]
  29. [CASCADE | RESTRICT]
  30. REVOKE [GRANT OPTION FOR] { CREATE | ALL [PRIVILEGES] }
  31. ON TABLESPACE <tablespacename> [, ...]
  32. FROM { <rolename> | PUBLIC } [, ...]
  33. [CASCADE | RESTRICT]
  34. REVOKE [ADMIN OPTION FOR] <parent_role> [, ...]
  35. FROM <member_role> [, ...]
  36. [CASCADE | RESTRICT]

Description

REVOKE command revokes previously granted privileges from one or more roles. The key word PUBLIC refers to the implicitly defined group of all roles.

See the description of the GRANT command for the meaning of the privilege types.

Note that any particular role will have the sum of privileges granted directly to it, privileges granted to any role it is presently a member of, and privileges granted to PUBLIC. Thus, for example, revoking SELECT privilege from PUBLIC does not necessarily mean that all roles have lost SELECT privilege on the object: those who have it granted directly or via another role will still have it.

If GRANT OPTION FOR is specified, only the grant option for the privilege is revoked, not the privilege itself. Otherwise, both the privilege and the grant option are revoked.

If a role holds a privilege with grant option and has granted it to other roles then the privileges held by those other roles are called dependent privileges. If the privilege or the grant option held by the first role is being revoked and dependent privileges exist, those dependent privileges are also revoked if CASCADE is specified, else the revoke action will fail. This recursive revocation only affects privileges that were granted through a chain of roles that is traceable to the role that is the subject of this REVOKE command. Thus, the affected roles may effectively keep the privilege if it was also granted through other roles.

When revoking membership in a role, GRANT OPTION is instead called ADMIN OPTION, but the behavior is similar.

Parameters

See GRANT.

Examples

Revoke insert privilege for the public on table films:

  1. REVOKE INSERT ON films FROM PUBLIC;

Revoke all privileges from role sally on view topten. Note that this actually means revoke all privileges that the current role granted (if not a superuser).

  1. REVOKE ALL PRIVILEGES ON topten FROM sally;

Revoke membership in role admins from user joe:

  1. REVOKE admins FROM joe;

Compatibility

The compatibility notes of the GRANT command also apply to REVOKE.

Either RESTRICT or CASCADE is required according to the standard, but HAWQ assumes RESTRICT by default.

See Also

GRANT