PostgreSQL继承postgres的权限

PostgreSQL inherit postgres's privileges

我按照文档使用createuser xxx -g postgres -i创建了一个帐户作为postgres的成员,但是新用户xxx似乎没有任何postgres的权限,比如create user和create db .这是为什么?

来自the docs

The role attributes LOGIN, SUPERUSER, CREATEDB, and CREATEROLE can be thought of as special privileges, but they are never inherited as ordinary privileges on database objects are. You must actually SET ROLE to a specific role having one of these attributes in order to make use of the attribute.

您的用户有权承担 postgres 的角色,但不继承 permission to create a user or database。您需要明确地授予(ALTER ROLE,实际上)。 (虽然用户可以自己授权)。