pgsql: Fix ordering in pg_dump of GRANTs

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix ordering in pg_dump of GRANTs
Date: 2017-09-14 00:05:43
Message-ID: E1dsHf5-0007ZA-OT@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix ordering in pg_dump of GRANTs

The order in which GRANTs are output is important as GRANTs which have
been GRANT'd by individuals via WITH GRANT OPTION GRANTs have to come
after the GRANT which included the WITH GRANT OPTION. This happens
naturally in the backend during normal operation as we only change
existing ACLs in-place, only add new ACLs to the end, and when removing
an ACL we remove any which depend on it also.

Also, adjust the comments in acl.h to make this clear.

Unfortunately, the updates to pg_dump to handle initial privileges
involved pulling apart ACLs and then combining them back together and
could end up putting them back together in an invalid order, leading to
dumps which wouldn't restore.

Fix this by adjusting the queries used by pg_dump to ensure that the
ACLs are rebuilt in the same order in which they were originally.

Back-patch to 9.6 where the changes for initial privileges were done.

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/68a7c24fdf2d69fc57cfb26aba7e119aa6ca2621

Modified Files
--------------
src/bin/pg_dump/dumputils.c | 51 ++++++++++++++++++++++++++++++++-------------
src/include/utils/acl.h | 14 ++++++++++---
2 files changed, 47 insertions(+), 18 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2017-09-14 02:49:54 Re: [COMMITTERS] pgsql: Use MINVALUE/MAXVALUE instead of UNBOUNDED for range partition b
Previous Message Michael Meskes 2017-09-13 23:20:37 Re: pgsql: Changed order of statements and added an additiona MSVC safeguar