REVOKE PRIVILEGE
REVOKE revokes privileges from a database object. The PUBLIC pseudo-role can
be used to indicate that the privileges should be revoked from all roles
(including roles that might not exist yet).
Syntax
ALL [PRIVILEGES] shorthand to refer to all
applicable privileges for the
object type.
For specific cluster(s):
REVOKE <USAGE | CREATE | ALL [PRIVILEGES]> [, ... ]
ON CLUSTER <name> [, ...]
FROM <role_name> [, ... ]
;
For all clusters:
REVOKE <USAGE | CREATE | ALL [PRIVILEGES]> [, ... ]
ON ALL CLUSTERS
FROM <role_name> [, ... ]
;
For specific connection(s):
REVOKE <USAGE | ALL [PRIVILEGES]>
ON CONNECTION <name> [, ...]
FROM <role_name> [, ... ];
For all connections or all connections in specific schema(s) or in database(s):
REVOKE <USAGE | ALL [PRIVILEGES]>
ON ALL CONNECTIONS
[ IN <SCHEMA | DATABASE> <name> [, <name> ...] ]
FROM <role_name> [, ... ];
For specific database(s):
REVOKE <USAGE | CREATE | ALL [PRIVILEGES]> [, ... ]
ON DATABASE <name> [, ...]
FROM <role_name> [, ... ];
For all database:
REVOKE <USAGE | CREATE | ALL [PRIVILEGES]> [, ... ]
ON ALL DATABASES
FROM <role_name> [, ... ];
SELECT privileges
on the view/materialized views. That is, having SELECT privileges on the
underlying objects defining the view/materialized view is insufficient.
For specific materialized view(s)/view(s)/source(s):
REVOKE <SELECT | ALL [PRIVILEGES]>
ON [TABLE] <name> [, <name> ...] -- For PostgreSQL compatibility, if specifying type, use TABLE
FROM <role_name> [, ... ];
For specific schema(s):
REVOKE <USAGE | CREATE | ALL [PRIVILEGES]> [, ... ]
ON SCHEMA <name> [, ...]
FROM <role_name> [, ... ];
For all schemas or all schemas in a specific database(s):
REVOKE <USAGE | CREATE | ALL [PRIVILEGES]> [, ... ]
ON ALL SCHEMAS [IN DATABASE <name> [, <name> ...]]
FROM <role_name> [, ... ];
For specific secret(s):
REVOKE <USAGE | ALL [PRIVILEGES]> [, ... ]
ON SECRET <name> [, ...]
FROM <role_name> [, ... ];
For all secrets or all secrets in a specific database(s):
REVOKE <USAGE | ALL [PRIVILEGES]> [, ... ]
ON ALL SECRET [IN DATABASE <name> [, <name> ...]]
FROM <role_name> [, ... ];
REVOKE <CREATEROLE | CREATEDB | CREATECLUSTER | CREATENETWORKPOLICY | ALL [PRIVILEGES]> [, ... ]
ON SYSTEM
FROM <role_name> [, ... ];
For specific view(s):
REVOKE <USAGE | ALL [PRIVILEGES]>
ON TYPE <name> [, <name> ...]
FROM <role_name> [, ... ];
For all types or all types in a specific schema(s) or in a specific database(s):
REVOKE <USAGE | ALL [PRIVILEGES]>
ON ALL TYPES
[ IN <SCHEMA|DATABASE> <name> [, <name> ...] ]
FROM <role_name> [, ... ];
For specific table(s):
REVOKE <SELECT | INSERT | UPDATE | DELETE | ALL [PRIVILEGES]> [, ...]
ON [TABLE] <name> [, <name> ...]
FROM <role_name> [, ... ];
For all tables or all tables in a specific schema(s) or in a specific database(s):
ALL TABLES […] also applies to sources, views, and
materialized views (for the applicable privileges).
REVOKE <SELECT | INSERT | UPDATE | DELETE | ALL [PRIVILEGES]> [, ...]
ON ALL TABLES
[ IN <SCHEMA|DATABASE> <name> [, <name> ...] ]
FROM <role_name> [, ... ];
Details
Applicable privileges to revoke
| Object | Privileges |
|---|---|
CLUSTER
|
|
CONNECTION
|
|
DATABASE
|
|
MATERIALIZED VIEW
|
|
SCHEMA
|
|
SECRET
|
|
SOURCE
|
|
SYSTEM
|
|
TABLE
|
|
TYPE
|
|
VIEW
|
|
Privileges
The privileges required to execute this statement are:
- Ownership of affected objects.
USAGEprivileges on the containing database if the affected object is a schema.USAGEprivileges on the containing schema if the affected object is namespaced by a schema.- superuser status if the privilege is a system privilege.
Examples
REVOKE SELECT ON mv FROM joe, mike;
REVOKE USAGE, CREATE ON DATABASE materialize FROM joe;
REVOKE ALL ON CLUSTER dev FROM joe;
REVOKE CREATEDB ON SYSTEM FROM joe;
Useful views
mz_internal.mz_show_system_privilegesmz_internal.mz_show_my_system_privilegesmz_internal.mz_show_cluster_privilegesmz_internal.mz_show_my_cluster_privilegesmz_internal.mz_show_database_privilegesmz_internal.mz_show_my_database_privilegesmz_internal.mz_show_schema_privilegesmz_internal.mz_show_my_schema_privilegesmz_internal.mz_show_object_privilegesmz_internal.mz_show_my_object_privilegesmz_internal.mz_show_all_privilegesmz_internal.mz_show_all_my_privileges