create user hspipmptemp with password 'hspipmptemp'; # 设置Postgres数据库为只读的transaction alter user hspipmptemp set default_transaction_read_only=on; # 赋予用户权限,查看public模式下所有表:(新建表也会有只读权限) grant usage on schema public to hspipmptemp; alter default privileges in schema public grant select on tables to hspipmptemp;
# 赋予用户连接数据库权限 grant connect on database zhong to hspipmptemp; # 切换到指定数据库 \c hspipmp # 赋予用户表、序列查看权限 grant usage on schema public to hspipmptemp; grant select on all sequences in schema public to hspipmptemp; grant select on all tables in schema public to hspipmptemp;
select * from pg_roles; select * from information_schema.table_privileges where grantee='cc';
|