创建一个只读用户 readonly
,将 db1
数据的所有表的只读权限赋予给 readonly
用户。
postgres=# create user readonly with password 'password';
postgres=# \c db1
You are now connected to database "db1" as user "postgres".
db1=# grant select on all tables in schema public to readonly;
完成