Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcx84-0002ON-Q4 for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Oct 2021 21:58:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mcx83-0002k3-OS for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Oct 2021 21:58:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcx83-0002ju-Gh for pgsql-bugs@lists.postgresql.org; Tue, 19 Oct 2021 21:58:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcx81-0003om-D6 for pgsql-bugs@lists.postgresql.org; Tue, 19 Oct 2021 21:58:38 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 19JLwYYP2008945; Tue, 19 Oct 2021 17:58:34 -0400 From: Tom Lane To: "Bossart, Nathan" cc: Masahiko Sawada , Michael Paquier , Neil Chen , "Boris P. Korzun" , "pgsql-bugs@lists.postgresql.org" Subject: Re: Inconsistent behavior of pg_dump/pg_restore on DEFAULT PRIVILEGES In-reply-to: <2C411167-8492-497B-A110-81E7081B1B0E@amazon.com> References: <8261632200581@mail.yandex.ru> <721942.1634180151@sss.pgh.pa.us> <1737876.1634613552@sss.pgh.pa.us> <1951182.1634673234@sss.pgh.pa.us> <2C411167-8492-497B-A110-81E7081B1B0E@amazon.com> Comments: In-reply-to "Bossart, Nathan" message dated "Tue, 19 Oct 2021 21:01:13 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2008943.1634680714.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 19 Oct 2021 17:58:34 -0400 Message-ID: <2008944.1634680714@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Bossart, Nathan" writes: > On 10/19/21, 12:54 PM, "Tom Lane" wrote: >> I kind of wonder now whether the existing behavior is correct for eithe= r >> 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