Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x4w0N-007VeP-2O for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Sep 2026 07:49:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x4w0M-00CxaM-2J for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Sep 2026 07:49:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x4vxJ-00CuTQ-0o for pgsql-bugs@lists.postgresql.org; Fri, 11 Sep 2026 07:45:53 +0000 Received: from mta05-relay.cloud.vadesecure.com ([195.154.80.82]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x4vxF-000000046vk-1vD5 for pgsql-bugs@lists.postgresql.org; Fri, 11 Sep 2026 07:45:52 +0000 Received: from zp-proxymta3.mdl.internal (unknown [77.72.93.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (3072 bits)) (No client certificate requested) by mta05-relay.cloud.vadesecure.com (vceu3mtao01p) with ESMTPS id 4hh66N11vYz7RXP; Fri, 11 Sep 2026 09:45:48 +0200 (CEST) Received: from zp-proxymta3.mdl.internal (localhost.localdomain [127.0.0.1]) by zp-proxymta3.mdl.internal (Postfix) with ESMTPS id 05C1358CF8; Fri, 11 Sep 2026 09:45:48 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by zp-proxymta3.mdl.internal (Postfix) with ESMTP id EC3CD5A99E; Fri, 11 Sep 2026 09:45:47 +0200 (CEST) Received: from zp-proxymta3.mdl.internal ([127.0.0.1]) by localhost (zp-proxymta3.mdl.internal [127.0.0.1]) (amavis, port 10026) with ESMTP id FYJipJBa3Wbs; Fri, 11 Sep 2026 09:45:47 +0200 (CEST) Received: from zp-mbx8.mdl.internal (zp-mbx8.mdl.internal [10.134.180.47]) by zp-proxymta3.mdl.internal (Postfix) with ESMTP id DAA5058CF8; Fri, 11 Sep 2026 09:45:47 +0200 (CEST) Date: Fri, 11 Sep 2026 09:45:47 +0200 (CEST) From: Sylvain PERRAUD To: Laurenz Albe Cc: pgsql-bugs@lists.postgresql.org Message-ID: <1852627963.39112866.1789112747804.JavaMail.zimbra@grandlyon.com> In-Reply-To: References: <19682-21342a50fcf153e5@postgresql.org> Subject: Re: BUG #19682: Unable to drop a user with default privileges revoked MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.134.182.11] X-Mailer: Zimbra 10.1.16_GA_4850 (ZimbraWebClient - GC153 (Win)/10.1.16_GA_4863) X-Authenticated-User: ext.solutec.sperraud@grandlyon.com Thread-Topic: BUG #19682: Unable to drop a user with default privileges revoked Thread-Index: zLVchxkIhji58zh9gMS/rVR4ZuWY9w== X-VRC-SPAM-STATUS: 0,-100,dmFkZTETxuurm1pTmb1zErXdWhxzd/a+EqjWCxoskYZJ8NCP5vWE7HU6LUpGFK6jArnaj90sX9IyjCow7LFh7vgqa+O8E07yj1LRW1GQS6dmY6+HHTNlK99UCj49jqk+8zakvpakaxz6kOAixvpUmr5Jtr+xJeuYFLGfOjAN5ptWN4T3RnHEKEWvvoAO9Duq7GkvLi3Q/bqJ8cW9XamJxMZ2L8YkbAyzbYMYekdq4pExFfcxMjGidpPHnSvApjhHROYUR1nW0fIGHBu4L93nsOejqhhW7bxAvWmBwBsy5rcyL5qxI5v0GyTtVz3FO89RJQh0fhYBiLp1z7TqnqYFXgxfiCZXSAkjyYjQEwMe7c43cAC/DZfe4ZFzGrelerTkvTE2EuiUUuc+QpZjcsy+QVCitAtuXU4LsKcRQcblErvtwD9lTRu+dzeKl1ex5i8efVkmqfqtt0C3v6TMpbqMClVpRpj4Fd/mBr5G28Hn4evn3eJXZUs33c3Ktz9n456b2nT1PNEsE2wL3ckhoSDuenhyIGLLdZsbV6oKRV11KYsMCVMmcnQWKE0kvJrb7Ni8M7Bjt8469Dpdzf07gVS3Iyc47TPzPCuTEBMtExR6AIwBl0HZyo2MYfu2i25KFlYXukt1iO8sY9m/obzRfQLtVE72ijvzfnaVdIwP5y8fbXnRjaH4ug X-VRC-SPAM-STATE: legit X-VRC-POLICY-STATUS: t=1,a=1,l=0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, My answers between >> << Cheers Sylvain ----- Mail original ----- De: "Laurenz Albe" =C3=80: "ext solutec sperraud" , pgsql-= bugs@lists.postgresql.org Envoy=C3=A9: Jeudi 10 Septembre 2026 15:49:00 Objet: Re: BUG #19682: Unable to drop a user with default privileges revoke= d On Wed, 2026-09-09 at 09:29 +0000, PG Bug reporting form wrote: > PostgreSQL version: 18.4 >=20 > Scenario 1 : create a user alpha then grant default privileges to himself >=20 > test=3D# create user alpha; >=20 > test=3D# ALTER DEFAULT PRIVILEGES FOR ROLE alpha GRANT ALL ON TABLES to = alpha; >=20 > test=3D# \ddp alpha > Default access privileges > Owner | Schema | Type | Access privileges > -------+--------+------+------------------- > (0 rows) >=20 > test=3D# drop user alpha; > > Conclusion 1 : Drop is working Right, because the ALTER DEFAULT PRIVILEGE did nothing. >> Ok I understand but in this situation, why \ddp is not showing access pr= ivileges "alpha=3DarwdDxtm/alpha+" like in scenario 3 ? How can we know the= hard-wired default privileges if \ddp is not showing anything. Even the vi= ew pg_catalog.pg_default_acl is empty : test=3D# select * from pg_catalog.pg_default_acl; oid | defaclrole | defaclnamespace | defaclobjtype | defaclacl -----+------------+-----------------+---------------+----------- (0 rows) << > Scenario 2 : create a user alpha then revoke default privileges from hims= elf > > test=3D# create user alpha; >=20 > test=3D# ALTER DEFAULT PRIVILEGES FOR ROLE alpha REVOKE ALL ON TABLES F= ROM alpha; >=20 > test=3D# \ddp alpha > Default access privileges > Owner | Schema | Type | Access privileges > -------+--------+-------+------------------- > alpha | | table | (none) > (1 row) >=20 > test=3D# drop user alpha; > ERROR: role "alpha" cannot be dropped because some objects depend on it > DETAIL: owner of default privileges on new relations belonging to role a= lpha >=20 > Conclusion 2 : Drop is not working Right, because now there are changed default privileges (an entry in pg_def= ault_acl), which prevents dropping the role. >> So the error message is confusing. It says "owner of default privileges = on new relations belonging to role alpha" and \ddp is showing "(none)" in a= cess privileges.=20 So how can we guess that we should grant default privileges (ALTER DEFAULT = PRIVILEGES FOR ROLE alpha GRANT ALL ON TABLES to alpha) to be able to drop = the role ? << > Scenario 3 : create a user alpha and beta then grant default privileges t= o both users > > test=3D# create user alpha; >=20 > test=3D# create user beta; >=20 > test=3D# ALTER DEFAULT PRIVILEGES FOR ROLE alpha GRANT ALL ON TABLES to = beta; >=20 > test=3D# \ddp alpha > Default access privileges > Owner | Schema | Type | Access privileges > -------+--------+-------+--------------------- > alpha | | table | beta=3DarwdDxtm/alpha > (1 row) That's not what I see. At this point, I see Default access privileges Owner =E2=94=82 Schema =E2=94=82 Type =E2=94=82 Access privileges =20 =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =AA=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=AA= =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90 alpha =E2=94=82 =E2=88=85 =E2=94=82 table =E2=94=82 alpha=3DarwdDxtm/= alpha=E2=86=B5 =E2=94=82 =E2=94=82 =E2=94=82 beta=3DarwdDxtm/alpha That's because you didn't revoke the default privileges for the owner, which are granted by default. > test=3D# ALTER DEFAULT PRIVILEGES FOR ROLE alpha GRANT ALL ON TABLES to = alpha; >=20 > test=3D# \ddp alpha > Default access privileges > Owner | Schema | Type | Access privileges > -------+--------+-------+---------------------- > alpha | | table | alpha=3DarwdDxtm/alpha+ > | | | beta=3DarwdDxtm/alpha > (1 row) I see the same thing after that second ALTER DEFAULT PRIVILEGES, because th= at statement did nothing. The privileges were already there. > test=3D# drop user alpha; > ERROR: role "alpha" cannot be dropped because some objects depend on it > DETAIL: owner of default privileges on new relations belonging to role a= lpha >=20 > test=3D# ALTER DEFAULT PRIVILEGES FOR ROLE alpha REVOKE ALL ON TABLES F= ROM beta; >=20 > test=3D# \ddp alpha > Default access privileges > Owner | Schema | Type | Access privileges > -------+--------+------+------------------- > (0 rows) Right, because removing the default privileges restored the "default" defau= lt privileges, so the entry for removed. > test=3D# drop user alpha; >=20 > Conclusion 3 : Drop is working whereas DEFAULT PRIVILEGES are still grant= ed to alpha Right, because those are the default default privileges. >> Here again it is confusing. When we are in this situation : test=3D# \ddp alpha Default access privileges Owner | Schema | Type | Access privileges -------+--------+-------+---------------------- alpha | | table | alpha=3DarwdDxtm/alpha+ | | | beta=3DarwdDxtm/alpha We can think that we should revoke default privileges for both users alpha = and beta to be able to drop role alpha. But if we revoke default privileges= for user alpha, then we are like scenario 2 and drop is not working. << In conclusion, you must have made a mistake somewhere to get that divergent intermediate result. Other than that, everything is behaving as it should. Yours, Laurenz Albe