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

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

示例

授予用户webuser对模式tpcds下视图的所有操作权限:
1
2
3
4
5
6
7
8
DO $$DECLARE r record;
BEGIN
    FOR r IN SELECT c.relname,n.nspname FROM pg_class c,pg_namespace n 
             WHERE c.relnamespace = n.oid AND n.nspname = 'tpcds' AND relkind IN ('r','v')
    LOOP
        EXECUTE 'GRANT ALL ON ' || quote_ident(r.table_schema) || '.' || quote_ident(r.table_name) || ' TO webuser';
    END LOOP;
END$$;
support.huaweicloud.com/sqlreference-dws/dws_06_0247.html