同一PostgreSQL数据库的两个所有者 [英] Two owners of the same PostgreSQL database

查看:327
本文介绍了同一PostgreSQL数据库的两个所有者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用Postgresql创建一个数据库,该数据库有2个用户,它们对数据库的拥有者的作用?



我可以创建组角色并将两个用户都添加到该组,然后使该组成为数据库的所有者,但这要求两个用户必须在每个连接上手动设置其角色,以使其他用户可以访问他们创建的任何表。

解决方案
解决方案

否,每个数据库只能有一个所有者。如前所述,您可以拥有多个超级用户,或者可以专门授予权限来对随后继承的角色进行分组。



您可能希望查看 http://blog.hagander.net/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 http://blog.hagander.net/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数据库的两个所有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆