云数据库 GaussDB-ALTER DEFAULT PRIVILEGES:示例

时间:2023-11-01 16:22:50

示例

 1 2 3 4 5 6 7 8 9101112131415
--将创建在模式tpcds里的所有表(和视图)的SELECT权限授予每一个用户。openGauss=# ALTER DEFAULT PRIVILEGES IN SCHEMA tpcds GRANT SELECT ON TABLES TO PUBLIC;--创建用户普通用户jack。openGauss=# CREATE USER jack PASSWORD 'xxxxxxxxxx';--将tpcds下的所有表的插入权限授予用户jack。openGauss=# ALTER DEFAULT PRIVILEGES IN SCHEMA tpcds GRANT INSERT ON TABLES TO jack;--撤销上述权限。openGauss=# ALTER DEFAULT PRIVILEGES IN SCHEMA tpcds REVOKE SELECT ON TABLES FROM PUBLIC; openGauss=# ALTER DEFAULT PRIVILEGES IN SCHEMA tpcds REVOKE INSERT ON TABLES FROM jack;--删除用户jack。openGauss=# DROP USER jack;
support.huaweicloud.com/distributed-devg-v2-opengauss/gaussdb-v5r2c10-0521.html