在phppgadmin里面怎么创建一个只读用户?
如题? 也许暂时可以用下面的方法alter user xxx set default_transaction_read_only = on;
来修改
,不过用户登录后自己设置 default_transaction_read_only 就不行了postgres=#
postgres=# create user ua;
CREATE ROLE
postgres=# alter user ua set default_transaction_read_only = on;
ALTER ROLE
postgres=# \c - ua
You are now connected to database "postgres" as user "ua".
postgres=> create table t(a int);
ERROR:cannot execute CREATE TABLE in a read-only transaction
postgres=>
postgres=>
postgres=>
postgres=> set default_transaction_read_only = off;
SET
postgres=> create table t1(a int);
CREATE TABLE
postgres=>回复 1# fender0107401
回复 2# asdf2110
我现在的做法是
1、建库 + 创建用户 + 设定为库的所有者。
2、关闭该库的public所有权限。
3、设定该库的read only用户有connect和select。
感觉PG的权限管理有点太细致了。
好像缺少 oracle 的 any 权限,比如要禁用 所有表的 insert 权限,pg貌似只能写许多
revoke insert on xxx from uuu;
回复 3# fender0107401
页:
[1]