From: Ben Hancock <lists@benghancock.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Create DB privilege is not inherited
Date: Thu, 27 Jul 2023 07:37:17 -0700
Message-ID: <20230727073717.56913598@shasta> (raw)
In-Reply-To: <CAKFQuwbJOYq6hOE-MF9K_2-0XZWK1XA2UpNHt2_SWQS=kVk5zQ@mail.gmail.com>
References: <20230727054737.1f192102@shasta>
<CAKFQuwbJOYq6hOE-MF9K_2-0XZWK1XA2UpNHt2_SWQS=kVk5zQ@mail.gmail.com>
On Thu, 27 Jul 2023 06:09:28 -0700
"David G. Johnston" <david.g.johnston@gmail.com> wrote:
> On Thursday, July 27, 2023, Ben Hancock <lists@benghancock.com> wrote:
> >
> >
> > 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?
> >
>
> Docs say:
>
> https://www.postgresql.org/docs/current/sql-createrole.html#:~:text=based%20authentication%20method....
> "
>
> 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."
>
Thank you David - I had managed to skim past that. So following this, it
looks like when I am "joe", I can set my role to "admins", and then
create the database I need:
postgres=> SET ROLE admins;
SET
postgres=> CREATE DATABASE joes_db;
CREATE DATABASE
Cheers!
Ben Hancock
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: <20230727073717.56913598@shasta>
References: <20230727054737.1f192102@shasta> <CAKFQuwbJOYq6hOE-MF9K_2-0XZWK1XA2UpNHt2_SWQS=kVk5zQ@mail.gmail.com> <20230727073717.56913598@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