同一PostgreSQL数据库的两个所有者

编程入门 行业动态 更新时间:2024-10-24 12:24:00
本文介绍了同一PostgreSQL数据库的两个所有者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否可以使用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数据库的两个所有者

本文发布于:2023-10-15 02:39:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1493010.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:所有者   两个   数据库   PostgreSQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!