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 1mcvBT-0006Ay-8J for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Oct 2021 19:54:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mcvBS-0004Rq-4x for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Oct 2021 19:54:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcvBR-0004Rh-Tl for pgsql-bugs@lists.postgresql.org; Tue, 19 Oct 2021 19:54:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcvBP-0006wy-Cl for pgsql-bugs@lists.postgresql.org; Tue, 19 Oct 2021 19:54:01 +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 19JJrsFA1951183; Tue, 19 Oct 2021 15:53:54 -0400 From: Tom Lane To: Masahiko Sawada cc: "Bossart, Nathan" , 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: References: <8261632200581@mail.yandex.ru> <721942.1634180151@sss.pgh.pa.us> <1737876.1634613552@sss.pgh.pa.us> Comments: In-reply-to Masahiko Sawada message dated "Tue, 19 Oct 2021 14:51:36 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1951181.1634673234.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 19 Oct 2021 15:53:54 -0400 Message-ID: <1951182.1634673234@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ... BTW, I think this patch is not correct yet. What I read in catalogs.sgml is ... If a global entry is present then it overrides the normal hard-wired default privile= ges for the object type. A per-schema entry, if present, represents privil= eges to be added to the global or hard-wired default pr= ivileges. I didn't check the code, but if that last bit is correct, then non-global entries aren't necessarily relative to the acldefault privileges either. I kind of wonder now whether the existing behavior is correct for either case. Why aren't we simply regurgitating the pg_default_acl entries verbatim? That is, I think maybe we don't need the acldefault call at all; we should just use null/empty as the starting ACL in all cases when printing pg_default_acl entries. Like this: buildACLQueries(acl_subquery, racl_subquery, initacl_subquery, initracl_subquery, "defaclacl", "defaclrole", "pip.initprivs", - "CASE WHEN defaclobjtype =3D 'S' THEN 's' ELSE def= aclobjtype END::\"char\"", + "NULL", dopt->binary_upgrade); I didn't test that. I suspect it will cause some regression test changes, but will they be wrong? regards, tom lane