【发布时间】:2020-02-04 17:11:56
【问题描述】:
关于这个主题已经有几个主题了。但是我无法完成它并不断收到“权限被拒绝”错误。我一定是做错了什么。
我的目标:我希望在我的 postgres 数据库“mydatabase”上拥有
- 属于角色“group_x”的一大组用户
- 角色“group_x”的每个成员都应该有权访问某个模式“schema_x”
- 在该架构中,所有组成员都应该能够创建新表并相互编辑(未来)表。
我是如何尝试的(大致):
psql -h /var/run/postgresql -p5433 -U postgres
create role group_x;
create role user_a LOGIN INHERIT PASSWORD <password>;
create role user_b LOGIN INHERIT PASSWORD <password>;
grant group_x to user_a;
grant group_x to user_b;
\connect mydatabase;
grant all on schema schema_x to group_x;
grant all on all tables in schema schema_x to group_x;
grant all on all sequences in schema schema_x to group_x;
grant all on all functions in schema schema_x to group_x;
set role group_x;
alter default privileges for role group_x in schema schema_x
grant all on tables to group_x;
alter default privileges for role group_x in schema schema_x
grant all on sequences to group_x;
alter default privileges for role group_x in schema schema_x
grant all on functions to group_x;
感谢您指出我的错误!
【问题讨论】:
标签: database postgresql permissions privileges sql-grant