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.

(强调我的).

相关文章

文章浏览阅读601次。Oracle的数据导入导出是一项基本的技能,...
文章浏览阅读553次。开头还是介绍一下群,如果感兴趣polardb...
文章浏览阅读3.5k次,点赞3次,收藏7次。折腾了两个小时多才...
文章浏览阅读2.7k次。JSON 代表 JavaScript Object Notation...
文章浏览阅读2.9k次,点赞2次,收藏6次。navicat 连接postgr...
文章浏览阅读1.4k次。postgre进阶sql,包含分组排序、JSON解...