数据仓库服务 GAUSSDB(DWS)-REVOKE:示例

时间:2024-10-16 16:27:27

示例

创建用户jim:

1
CREATE USER jim PASSWORD '{Password}';

创建模式:

CREATE SCHEMA tpcds;

创建数据库:

CREATE DATABASE mydatabase OWNER jim;

创建表:

1
CREATE TABLE IF NOT EXISTS tpcds.reason(r_reason_sk int,r_reason_id int,r_reason_desc int);

创建视图:

1
CREATE VIEW myview AS select * from tpcds.reason;
撤销jim用户的所有权限:
1
REVOKE ALL PRIVILEGES FROM jim;
撤销指定模式上授予的权限:
1
REVOKE USAGE,CREATE ON SCHEMA tpcds FROM jim;

撤销jim用户的CONNECT特权:

1
REVOKE CONNECT ON DATABASE mydatabase FROM jim;

从用户jim撤销角色dbadmin中的成员资格:

1
REVOKE dbadmin FROM jim;

撤销用户jim对视图myView具有的所有特权:

1
REVOKE ALL PRIVILEGES ON myView FROM jim;

撤销针对表customer_t1的公共插入特权:

1
REVOKE INSERT ON tpcds.reason FROM PUBLIC;

撤销用户jim对tpcds.reason表中r_reason_sk,r_reason_id的查询权限:

1
REVOKE select (r_reason_sk, r_reason_id) ON tpcds.reason FROM jim;

撤销用户jim的函数权限:

1
2
3
4
5
6
CREATE FUNCTION func_add_sql(integer, integer) RETURNS integer
    AS 'select $1 + $2;'
    LANGUAGE SQL
    IMMUTABLE
    RETURNS NULL ON NULL INPUT;
REVOKE execute ON FUNCTION func_add_sql(integer, integer) FROM jim CASCADE;
support.huaweicloud.com/sqlreference-dws/dws_06_0253.html