文章目录
- 前言
前言
按四步走
--1 创建用户
CREATE USER reado WITH ENCRYPTED PASSWORD 'reado';--2 开启只读事务
alter user reado set default_transaction_read_only=on;-- 3 授予特定模式的使用权限
GRANT USAGE ON SCHEMA public, common, espc TO reado;GRANT USAGE ON SCHEMA dimension TO reado;GRANT USAGE ON schema unified_data.dimension TO reado;-- 查看模式的使用权限
SELECT schema_name, has_schema_privilege('reado', schema_name, 'USAGE') AS has_usage_privilege
FROM information_schema.schemata;--4 授予指定模式下所有表的查看权限
GRANT SELECT ON ALL TABLES IN SCHEMA dimension TO reado;-- 查看espc模式下的所有表
select table_name from information_schema.tables WHERE table_schema = 'espc';