Re: dumping database privileges broken in 9.6 - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: dumping database privileges broken in 9.6
Date
Msg-id CAB7nPqTW935tzn+5WR9t8rk9L=ZiF9fQ6HzPs_97=ebcTV_wBQ@mail.gmail.com
Whole thread Raw
In response to Re: dumping database privileges broken in 9.6  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
On Wed, Jul 13, 2016 at 5:18 AM, Stephen Frost <sfrost@snowman.net> wrote:
> Attached is a patch to address this.
>
> After much consideration and deliberation, I went with the simpler
> solution to simply dump out the database privileges based on what a new
> creation of those privileges would yield, resulting in output similar to
> pre-9.6.  We document that template1 is allowed to be dropped/recreated,
> which greatly complicates using pg_init_privs to record and produce a
> delta against the initdb-time values, as we lose the connection between
> pg_init_privs and the "template1" database as soon as it is dropped
> (something which can't be done with objects in that catalog).

+        "(SELECT pg_catalog.array_agg(acl) FROM (SELECT
pg_catalog.unnest(coalesce(datacl,pg_catalog.acldefault('d',datdba)))
AS acl "
+        "EXCEPT SELECT
pg_catalog.unnest(pg_catalog.acldefault('d',datdba))) as foo)"
+        "AS datacl,"
+        "(SELECT pg_catalog.array_agg(acl) FROM (SELECT
pg_catalog.unnest(pg_catalog.acldefault('d',datdba)) AS acl "
+        "EXCEPT SELECT
pg_catalog.unnest(coalesce(datacl,pg_catalog.acldefault('d',datdba))))
as foo)"
+        "AS rdatacl,"
It took me some time to understand that those are the GRANT and REVOKE
ACLs separated into two columns to get advantage of buildACLCommands..
-- 
Michael



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Simplifying the interface of UpdateMinRecoveryPoint
Next
From: Albe Laurenz
Date:
Subject: Documentation fix for CREATE FUNCTION