我正在使用fallowing脚本来创建用户。
CREATE ROLE readonly LOGIN PASSWORD 'thePwd';
-- Existing objects
GRANT CONNECT ON DATABASE the_db TO readonly;
GRANT USAGE ON SCHEMA public TO readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO readonly;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO readonly;
创建用户&角色; " readonly"用户有" SELECT"允许。没有丢弃或截断权限。但是" readonly"用户有权"更改表"命令。
如何限制特定用户"更改表格"权利?
有一个简单的例子吗?
答案 0 :(得分:0)
解决方案在以下脚本中;
create user dummy_user with nosuperuser encrypted password 'dummy_password';
GRANT CONNECT ON DATABASE the_db TO dummy_user;
GRANT USAGE ON SCHEMA public TO dummy_user;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO dummy_user;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO dummy_user;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO dummy_user;