标签:
先进入psql
切换到目标数据库
\c mydb
对于老表
grant usage on schema public to $read_only_user; grant select on all tables in schema public to $read_only_user;
设置默认,对于未创建的表直接默认赋予只读权限
alter default privileges for user $db_owner in schema public grant select on tables to $read_only_user;
pubic这个schema是默认的schema
测试建表语句
create table t2 ( id serial, name varchar(64) );
标签:
原文地址:http://www.cnblogs.com/ziyouchutuwenwu/p/5674093.html