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 1mcfeq-00065G-V9 for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Oct 2021 03:19:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mcfep-0003Nz-Kh for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Oct 2021 03:19:19 +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 1mcfep-0003Nq-DZ for pgsql-bugs@lists.postgresql.org; Tue, 19 Oct 2021 03:19:19 +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 1mcfen-0005j4-5q for pgsql-bugs@lists.postgresql.org; Tue, 19 Oct 2021 03:19:19 +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 19J3JCbT1737877; Mon, 18 Oct 2021 23:19:12 -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> Comments: In-reply-to Masahiko Sawada message dated "Tue, 19 Oct 2021 11:04:32 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1737875.1634613552.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 18 Oct 2021 23:19:12 -0400 Message-ID: <1737876.1634613552@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Masahiko Sawada writes: > I've looked at the patch proposed you proposed. If we can depend on > acldefault() being STRICT (which is legitimate to me), I think we > don't need to build an expression depending on the caller (i.g., > is_default_acl). If acldefault() were to become not STRICT, we could > detect it by regression tests. What do you think? FWIW, I'm working on a refactoring of this logic that will bring the acldefault() call into the getDefaultACLs code, which would mean that we won't need that assumption anymore anyway. The code as I have it produces SQL like acldefault(CASE WHEN defaclobjtype =3D 'S' THEN 's'::"char" ELSE defaclobjtype END, defaclrole) AS ac= ldefault and we could wrap the test-for-zero around that: CASE WHEN defaclnamespace =3D 0 THEN acldefault(CASE WHEN defaclobjtype =3D 'S' THEN 's'::"char" ELSE defaclobjtype END, defaclrole) ELSE NULL END AS acldefault (although I think it might be better to write ELSE '{}' not ELSE NULL). So I think we don't need to worry about whether acldefault() will stay strict. This patch will only need to work in the back branches. regards, tom lane