Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iWfdr-0001Dd-9j for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Nov 2019 11:56:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iWfdp-0004M6-RJ for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Nov 2019 11:56:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iWfdp-0004Lz-Iv for pgsql-bugs@lists.postgresql.org; Mon, 18 Nov 2019 11:56:25 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iWfdn-0006gr-9z for pgsql-bugs@lists.postgresql.org; Mon, 18 Nov 2019 11:56:25 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E4A0F22632; Mon, 18 Nov 2019 06:56:20 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 18 Nov 2019 06:56:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=LImjTcjs/zZMTFO0edZFICuX8AN PBkbaZ6/vqtc1AdA=; b=E9cKTYk+B4D2BvuiyfmyJd5b+Tb914vuLemyMD3UqHj xz9i7r3y053GNaJqGHPvZ8ZSqwGKqzkB3Kb0JWaWpdkQ1QFX/0Q4I3gopJRwKSpI N2OegRilBmG5N8Gw3PKEe9ct8MyCLt4P/PFQCUZq/qEiIXQ4MuQwz540p/Vj5F2b BAvWQj+ow4asNpxn9VBk03UrYaasUgrL/nblhAec5lXhXoePtbeJhfto09meI/e+ u1+goTXwPigF9k/wK026szc9hCh4KYC2uLnzecuSapPTxl9RrS8gnmFAvPOpbATb FaI4qmImxKfEB4Yn9Oetsb65m1vjrx3gxQRmWp20y2Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=LImjTc js/zZMTFO0edZFICuX8ANPBkbaZ6/vqtc1AdA=; b=n051iYMM08lk97lx3pqw9/ HRzyMCivmUCieyi5qtT9d9DFk05cK6hdVDs6WkwfgYt8A8+FIezW1PHQDoLtiqCB 5QXXw6iT05pM7oXvHOmEeFMIRrWeGomCLPzV3vK74+AnUD/6Hbh7ONIFAJQV+P/x N/9QH5I9aOHhq0RPfcj/D84axIcxXoXs82vf8ftSbGOcB0RMDHFXbicPdgNbxx/4 NCsAVDFEjpa/PxiJc7XJG1AKXgRPTSzwJyQWKht88r8OTRQfq2iMQX7sHcdWlvPA gLrmm+yzeLf2bgkZUV//ISouw67qF+uEZv81AxEbKxd+1jc+VFeeLROB6tjXNe3A == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudegiedguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucfkphepudduuddruddtvddrudektddrudekheenucfrrghr rghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiienucevlh hushhtvghrufhiiigvpedt X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 2EA2A3060057; Mon, 18 Nov 2019 06:56:18 -0500 (EST) Date: Mon, 18 Nov 2019 20:56:16 +0900 From: Michael Paquier To: Floris Van Nee Cc: Tom Lane , "pgsql-bugs@lists.postgresql.org" , Ferdi Smit , Stephen Frost Subject: Re: incorrect pg_dump output due to not handling dropped roles correctly Message-ID: <20191118115616.GF1543@paquier.xyz> References: <1573808483712.96817@Optiver.com> <29913.1573835973@sss.pgh.pa.us> <1574024173786.96623@Optiver.com> <20191118031059.GA1543@paquier.xyz> <20191118041433.GB1543@paquier.xyz> <1574068566573.13088@Optiver.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IvGM3kKqwtniy32b" Content-Disposition: inline In-Reply-To: <1574068566573.13088@Optiver.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --IvGM3kKqwtniy32b Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 18, 2019 at 09:16:06AM +0000, Floris Van Nee wrote: > So, if we do it during DROP OWNED BY, we should also handle it > during one of the below REVOKE commands. Perhaps DROP OWNED BY > already calls one of these functions internally - in that case you > can ignore my comment. Just wanted to make sure we catch all > possible cases this can occur.=20 One problem here is that you would need to scan and track down all the entries in pg_init_privs if you'd like to make sure that all the traces of the role have been removed, so that's really not good for performance. The fix I was actually imagining upthread would be to add a new type of entry in pg_shdepend linking the role with pg_init_privs for the object where an ACL is added. This would prevent DROP ROLE to complete with your scenarios, and if the role ownerships are dropped we could use the link between the object and the role to remove directly the ACL for the role in the object. That's not really backpatchable unfortunately. On top of the new pg_depend type we would need a new cleanup routine similar to what happens for policy ACLs when dropping a role. -- Michael --IvGM3kKqwtniy32b Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl3ShuAACgkQnvQgOdby QH1vlQ//fRbjpGFT0/RMWfz2PAvE6msLh8ZGSSiRHzFzaJszkSAzGn27EFxxa+En uGIMrefXbz+qD5SO4dFeX4/MiJn6+Ik8OSFgpg1gjt3TXTwuRNBsJIUwS3cB22Da Pu5x3ozFbLITEo2Y+dYhp6mSH56ls1G0F/2q/gdF+SST0tdOTIdrV1v44KDnIInN 56ZflE2SKUbBjH1ov0uOVCJP6a3kPs8tJq1lgxy0uP7e3jRa/yZX2PkA9mFaN/4S eNl4B9wZONwLpO8J9t+6lR1kv7btvg7eU+LibqXewC18V6JOnIOmQ5d1HFpdfQ+h L8fg9JIKbvkh0J+VFU30QgPMieGRaZLJobRsz9I7eGx8JgcQTYnRRgYN4N+xsq3v fdiJzdTCXeZ3izQrclWfIr9kLL2NJTS1siD6rXCUuDYMDylXHn0fpmBwffL830pE c2cm6zjsSQQqUL+ieo/TmY8uai659O8qDeNjyf7IpdJPiiH2ib8oeFd4j5J7T4CR u5BMhaamA1PDU5X8FM6j0n740jhOPhcdMvNzzzg3WTFoQzD8bC3MM2dGsdY/+LZt NKSR8HoRW+JPMHudCDq9dpRIwcwxqc07QY9K6rnEuggLxMU90osrJ86mXxbD25xw mnmbvDvC4g8d8R05kOAfBi+o7/nQ12SO/YyvOwkU82oxwixok+M= =Z2pj -----END PGP SIGNATURE----- --IvGM3kKqwtniy32b--