微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

postgresql – Postgres在授予角色权限后无法创建数据库

我确定我错过了一些简单的东西,但我创造了以下内容

postgres=# \du
                          List of roles
 Role name |               Attributes                | Member of
-----------+-----------------------------------------+-----------
 admin     | No inheritance,Create DB,Cannot login | {}
 postgres  | Superuser,Create role,Create DB       | {}
 wade      |                                         | {admin}

(请注意,无法登录和无继承不会影响正在发生的事情.请参阅PostgreSQL documentation for role membership以了解原因.-bignose)

但是,当我尝试创建数据库时,我得到:

bin wwilliam$createdb -U wade test
Password:
createdb: database creation Failed: ERROR:  permission denied to create database

我错过了什么?

解决方法

manual的摘录:

The INHERIT attribute governs inheritance of grantable privileges (that is,access privileges for database objects and role memberships). It does not apply to the special role attributes set by CREATE ROLE and ALTER ROLE. For example,being a member of a role with CREATEDB privilege does not immediately grant the ability to create databases,even if INHERIT is set; it would be necessary to become that role via SET ROLE before creating a database.

(强调我的).

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐