Re: Inconsistent behavior of pg_dump/pg_restore on DEFAULT PRIVILEGES

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Bossart, Nathan" <bossartn@amazon.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>, Michael Paquier <michael@paquier.xyz>, Neil Chen <carpenter.nail.cz@gmail.com>, "Boris P. Korzun" <drtr0jan@yandex.ru>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2021-10-19T21:58:34Z
Lists: pgsql-bugs, pgsql-hackers
"Bossart, Nathan" <bossartn@amazon.com> writes:
> On 10/19/21, 12:54 PM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
>> I kind of wonder now whether the existing behavior is correct for either
>> case.

> Hm.  If we do this, then this command:
>         ALTER DEFAULT PRIVILEGES FOR ROLE myrole REVOKE ALL ON FUNCTIONS FROM PUBLIC;
> is dumped as:
>         ALTER DEFAULT PRIVILEGES FOR ROLE myrole GRANT ALL ON FUNCTIONS  TO myrole;

[ pokes at it some more... ]  Yeah, I just didn't have my head screwed
on straight.  We need the global entries to be dumped as deltas from
the proper object-type-specific ACL, while the non-global ones should be
dumped as grants only, which can be modeled as a delta from an empty
ACL.  So the patch should be good as given (though maybe the comment
needs more work to clarify this).  Sorry for the noise.

			regards, tom lane



Commits

  1. pg_dump: fix mis-dumping of non-global default privileges.