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 1p5hSV-00040o-09 for pgsql-general@arkaria.postgresql.org; Thu, 15 Dec 2022 06:11:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p5hST-0006Kv-EX for pgsql-general@arkaria.postgresql.org; Thu, 15 Dec 2022 06:11:05 +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 1p5hST-0006Kl-4D for pgsql-general@lists.postgresql.org; Thu, 15 Dec 2022 06:11:05 +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 1p5hSM-0001gP-Dx for pgsql-general@lists.postgresql.org; Thu, 15 Dec 2022 06:11:04 +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 2BF6At0Q3300817; Thu, 15 Dec 2022 01:10:55 -0500 From: Tom Lane To: Ron cc: pgsql-general@lists.postgresql.org, Bryn Llewellyn Subject: Re: Test if a database has any privilege granted to public In-reply-to: References: <0BFC452B-0AC8-46B3-9E65-B685544ED110@yugabyte.com> Comments: In-reply-to Ron message dated "Thu, 15 Dec 2022 00:03:08 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3300815.1671084655.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 15 Dec 2022 01:10:55 -0500 Message-ID: <3300816.1671084655@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ron writes: > Off-topic, but you don't need all those text casts. Indeed. Something like this ought to do it: =3D# select datname from pg_database where 0::oid =3D any(select (aclexplo= de(datacl)).grantee); datname = ------------ template1 template0 regression (3 rows) regards, tom lane