PostgreSQL 版本 9.0
我需要一个将 postgresql 用户分组的想法。
我在数据库中有 150 多个表,我想解决一群人。其中一些可以到达所有 table ,有些则不能。 我知道可以使用授权或创建角色来实现。但我想弄清楚哪种方法最好。它将如何影响性能?
让所有用户访问某些表并管理它们对我来说似乎很难。所以我想到了如何创建不同的表空间并按表空间设置权限。
是否有创建用户组的好的教程、文章或方法?你有什么建议?
最佳答案
如果您按表空间设置权限,并且需求发生变化,会计人员需要访问另一个表,那么您必须将该表从一个表空间移动到另一个表空间。但是话又说回来,您不能将该表移动到不同的表空间而不破坏所有其他用户的权限。
不要那样做。
相反,为您的用户创建逻辑组,将用户分配给组,并为组分配权限。 The PostgreSQL term is "roles" .
It is frequently convenient to group users together to ease management of privileges: that way, privileges can be granted to, or revoked from, a group as a whole. In PostgreSQL this is done by creating a role that represents the group, and then granting membership in the group role to individual user roles.
关于PostgreSQL 用户组和权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7568034/