pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ben Hancock <lists@benghancock.com>
To: List-Postgres-General <pgsql-general@lists.postgresql.org>
Subject: Create DB privilege is not inherited
Date: Thu, 27 Jul 2023 05:47:37 -0700
Message-ID: <20230727054737.1f192102@shasta> (raw)

Hi folks,

I've created a role 'admins' and conferred the CREATEDB and CREATE ROLE
privileges to this role. I'd like to be able to add users to this role
in order to easily manage group permissions. This doesn't seem to be
working the way I understand it should, though:

postgres=# CREATE ROLE admins WITH CREATEROLE CREATEDB;
CREATE ROLE
postgres=# CREATE USER joe;
CREATE ROLE
postgres=# GRANT admins TO joe;
GRANT ROLE
postgres=# SET ROLE joe;
SET
postgres=> CREATE DATABASE joes_db;
ERROR:  permission denied to create database
postgres=> \dg
                                          List of roles
    Role name     |                         Attributes                         |    Member of
------------------+------------------------------------------------------------+-----------------
 admins           | Create role, Create DB, Cannot login                       | {}
 joe              |                                                            | {admins}
 postgres         | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

postgres=>

Should the CREATEDB privilege be inherited when granting the 'admins'
role to a user, or is another step required?

Or (quite possibly) have I misunderstood something else?

Many thanks,

Ben Hancock
PostgreSQL 14.3





view thread (3+ messages)  latest in thread

Message-ID: <20230727054737.1f192102@shasta>
Permalink:  ../20230727054737.1f192102@shasta/
Also on:    postgresql.org/message-id/20230727054737.1f192102@shasta

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: lists@benghancock.com
  Subject: Re: Create DB privilege is not inherited
  In-Reply-To: <20230727054737.1f192102@shasta>
  References: <20230727054737.1f192102@shasta>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox