Skip to main content

REVOKE

使用 REVOKE 命令撤销用户的权限。

句法

撤销用户的权限。

REVOKE {{CONNECT | CREATE}[, ...]| ALL [PRIVILEGES]} 
ON DATABASE database_name [, ...]
FROM user_name [GRANTED BY user_name];

撤销用户的 schema 权限。

REVOKE {CREATE | ALL [PRIVILEGES]} 
ON SCHEMA schema_name [, ...]
FROM user_name [GRANTED BY user_name];

撤销用户的表权限。

REVOKE {{SELECT | UPDATE | INSERT | DELETE} [, ...]| ALL [PRIVILEGES]} 
ON { TABLE table_name [, ...]
| ALL TABLES IN SCHEMA schema_name [, ...] }
FROM user_name [GRANTED BY user_name];

撤销用户的 source 权限。

REVOKE {SELECT | ALL [PRIVILEGES]} 
ON { SOURCE source_name [, ...]
| ALL SOURCES IN SCHEMA schema_name [, ...] }
FROM user_name [GRANTED BY user_name];

撤销用户的物化视图权限。

REVOKE {SELECT | ALL [PRIVILEGES]} 
ON {MATERIALIZED VIEW mv_name [, ...]
| ALL MATERIALIZED VIEWS IN SCHEMA schema_name [, ...] }
FROM user_name [GRANTED BY user_name];

参数

参数或子句描述
GRANTED BY 子句GRANTED BY 子句后指定的用户必须是当前用户。默认情况下,当前用户为 root

示例

撤销用户 user1schema1 中所有 source 的所有权限。

REVOKE ALL PRIVILEGES 
ON ALL SOURCES IN SCHEMA schema1
FROM user1 GRANTED BY user;

撤销用户 user1 对数据库 db1 的 schema schema1 中的物化视图 mv1 的 SELECT 权限。

REVOKE SELECT
ON MATERIALIZED VIEW mv1 IN SCHEMA db1.schema1
FROM user1;

撤销用户 user1 对 source s1 的 SELECT 权限。

REVOKE SELECT
ON SOURCE s1
FROM user1;