是否可以使用Postgresql创建一个数据库,该数据库有2个用户,它们对数据库的拥有者的作用?
我可以创建组角色并将两个用户都添加到该组,然后使该组成为数据库的所有者,但这要求两个用户必须在每个连接上手动设置其角色,以使其他用户可以访问他们创建的任何表。
解决方案解决方案否,每个数据库只能有一个所有者。如前所述,您可以拥有多个超级用户,或者可以专门授予权限来对随后继承的角色进行分组。
您可能希望查看 blog.hagander/archives/70-Faking-the-dbo -role.html ,用于伪造与您所要内容相似的内容。它并不完美,但对您来说可能足够了。它至少应该能够解决对象所有权问题。
Is it possible with Postgresql to create a database which has 2 users which act like owners to the database?
I can create a group role and add both users to that group, and then make the group the owner of the database, but this requires both users to be have to manually set their role on every connection to make any tables they have created accessible to the other user. Is there any way to make the group be the default role for a user each time they log in or any other way to achieve the same thing?
解决方案No, each database can only have one owner. As stated previously you can have more than one superuser, or you can grant permissions specifically to group roles that are then inherited.
You might want to look at blog.hagander/archives/70-Faking-the-dbo-role.html, for a way to fake something similar to what you're asking for. It's not perfect, but it might be good enough for you. It should be able to solve the object-ownership problem at least.
更多推荐
同一PostgreSQL数据库的两个所有者
发布评论