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 1q5QzH-0001Lc-Gx for pgsql-general@arkaria.postgresql.org; Sat, 03 Jun 2023 13:08: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 1q5QzF-000782-Mv for pgsql-general@arkaria.postgresql.org; Sat, 03 Jun 2023 13:08: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 1q5QzF-00077t-Bv for pgsql-general@lists.postgresql.org; Sat, 03 Jun 2023 13:08:05 +0000 Received: from mout-u-204.mailbox.org ([2001:67c:2050:101:465::204]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q5Qz8-003tKq-8i for pgsql-general@postgresql.org; Sat, 03 Jun 2023 13:08:04 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4QYKt06LBYz9scT; Sat, 3 Jun 2023 15:07:52 +0200 (CEST) Date: Sat, 3 Jun 2023 15:07:52 +0200 (CEST) From: Erik Wienhold To: Andrus , pgsql-general Message-ID: <1408288797.797459.1685797672449@office.mailbox.org> In-Reply-To: <2140448238.796716.1685796376553@office.mailbox.org> References: <568e6761-d224-7c72-59f3-267b39bde227@hot.ee> <2140448238.796716.1685796376553@office.mailbox.org> Subject: Re: How to remove user specific grant and revoke MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 03/06/2023 14:46 CEST Erik Wienhold wrote: > > > On 03/06/2023 09:16 CEST Andrus wrote: > > > > DROP REVOKE ALL ON TABLE public.kaspriv FROM all EXCEPT public; > > DROP GRANT SELECT ON TABLE public.kaspriv FROM all EXCEPT public; > > > > This will be one-time action. It can be done manually in pgadmin or using > > some script running once. > > Automate this with aclexplode[0] to get the privileges for specific grantees. > Loop over the result set in a DO block, generate the REVOKE commands, and > EXECUTE them. > > SELECT acl.grantee::regrole, acl.privilege_type > FROM pg_class, aclexplode(relacl) acl > WHERE oid = 'public.kaspriv'::regclass; Or just execute those REVOKE ALL commands (except for PUBLIC) that pgAdmin already gives you. -- Erik