Re: create database with template doesn't copy ACL

From: Joseph Nahmias <joe(at)nahmias(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: create database with template doesn't copy ACL
Date: 2020-06-14 07:26:13
Message-ID: 20200614072613.GA21852@nahmias.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

On Fri, Jun 12, 2020 at 05:29:51PM -0400, Bruce Momjian wrote:
> On Fri, Jun 5, 2020 at 02:31:34PM +0000, PG Doc comments form wrote:
> > The following documentation comment has been logged on the website:
> >
> > Page: https://www.postgresql.org/docs/11/sql-createdatabase.html
> > Description:
> >
> > My understanding is that not copying the ACL is the (currently) expected
> > behavior when issuing CREATE DATABASE newdb WITH TEMPLATE my_tmpl;
> > It would be useful for the documentation to note this caveat.
>
> Uh, what ACLs are not copied?

The ACL on the database itself. For example:

postgres(at)postgres[[local]#9655]=# CREATE DATABASE acl_template WITH IS_TEMPLATE = 1;
CREATE DATABASE
postgres(at)postgres[[local]#9655]=# REVOKE ALL ON DATABASE acl_template FROM PUBLIC;
REVOKE
postgres(at)postgres[[local]#9655]=# CREATE DATABASE acl_test WITH TEMPLATE = acl_template;
CREATE DATABASE
postgres(at)postgres[[local]#9655]=# SELECT datname, datacl FROM pg_database WHERE datname LIKE 'acl%';
datname | datacl
--------------+-------------------------
acl_template | {postgres=CTc/postgres}
acl_test |
(2 rows)

Here, the ACL on the new acl_test database does NOT match the ACL on the
acl_template database upon which it is based.

Hope this helps,
--Joe

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Euler Taveira 2020-06-14 16:33:38 Re: Signed-ness of ints is unclear in FE-BE protocol docs
Previous Message PG Doc comments form 2020-06-14 01:16:00 serial attribute type vs GENERATED AS IDENTITY

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2020-06-14 08:51:14 Re: Transactions involving multiple postgres foreign servers, take 2
Previous Message Etsuro Fujita 2020-06-14 07:23:49 Re: problem with RETURNING and update row movement