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 1x52ug-007aLR-07 for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Sep 2026 15:11:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x52ud-00FTZ3-2s for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Sep 2026 15:11:35 +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 1x52ud-00FTYu-1i for pgsql-bugs@lists.postgresql.org; Fri, 11 Sep 2026 15:11:35 +0000 Received: from mail-wm2-x10.google.com ([2a00:1450:4864:31::10]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x52ub-00000004AaO-02kf for pgsql-bugs@lists.postgresql.org; Fri, 11 Sep 2026 15:11:35 +0000 Received: by mail-wm2-x10.google.com with SMTP id 5b1f17b1804b1-49ccfd61ecaso3645e9.3 for ; Fri, 11 Sep 2026 08:11:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1789139492; x=1789744292; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to:content-type; bh=cqr1vLUUt6EyGHjvyMhjElaM+MSJizaRRGlO6WmrM8A=; b=KMxQQMhTK0Fx+dG23t4HCbQvcgaBdTGRRbQRMf2Fr3j6Zlp63p5gM58k8DKicfCq78 G5Qy8wPLhuAjsCZJdpZjgJ6AcbQqzlSwZPYvMuj9hQNm94whnlXniqzSYrztlX9+ZLQz QLl9t4hZUbaGzmQByNcNvtzVjSbwUqTHiXJwkP7Oa4hg2z8IDyYx/GWExPod+KGrFrbO szHytPKjNrDl6f+tds2208/4h/EE2Xdy0xHrjAqB2lPBZZ+71UemX/qusmFZZrBktWP6 /mp0hUIGqezu3icRhakkoZPpH1+g8EUpQAQ/H3D4qhSBQImxzrq4pQ7nb07w5XJvw0oH cwyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789139492; x=1789744292; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=cqr1vLUUt6EyGHjvyMhjElaM+MSJizaRRGlO6WmrM8A=; b=iYIu01jFcqV0wAY2f7/+98QHCQLEN04er19ld/rnfmlVtmCUxTkq/WbCDpP6p3/RZ5 PiSm5nFMC5GA86IdXy+i0FEpyz/FM6ZxRvq3TmfBIGUg9cYoD6yVeHuRn5L6GjyF116k MxjrxflDkSQJhNbx2TBNJ6sah/gqOLPlWZqI01VW967kE6weIJXV6mfYeGxW3NZtHacx jPnIBhfTv1HSC7B91joGXH0e2QVJEc4p1vGVKkHh/DFGaS6roMbmVIDkqQnDflvyobBo f8qHk20Brmx0ND6FORCDcThJQ/HayU7O+IrANutN29d3MHyJLT3E8ISdQ75z2x8nP4YW FonA== X-Gm-Message-State: AFuF++l+mglYvIY8fqwecJO61znYH+4z4wWnFdvD0aYp8BlfG7Gbd9UT Q0XUJa3LoIhjQ6Icehkcm58DHKeP5SSPN6jb0D204ScqhBd6zz+zNzhpv0xNxVURJoM= X-Gm-Gg: AYBFou0vWzDByyhTgve+ZEAEm3NvLXrCfTmK6pBweP8fI4zBbnrUnwChvhoNc4e/67y fykthk6aljnp1auXelXEOMyDr2PpsOgacxXXEHP/jq2IKUZ7b97dk9uaTr8LKdbEcmWRs6bpUha JivIH9xl7Kc8KGFcDxz50ZDOkDvnTJ0DHnvlrZCMXkDeLYzflLJgCXAHTWNCLHUi2StTtAO2G6d RM3Ke33VlYA7d+X0q05PLuolSSldaF+odwSCONtCntsaafN3LZrIo8Auhe3KSW75YUStq2jE64V jwwB4wfrl9TqJIxdWzmS6bqROiYx+ek8eggrzI6IGOjf2jAls0Muqyub4KdGhrs2yAG7x0GdNf3 UeHsZK5EmWqruZkqQdflOMeL4uJ8GUZjb3IuAae2e97EUoWLAeTTwV/18766REICYJuOkD1VeRV HVWz0eI69A/eChG2QwvHqSEYRI/+PEZdVhF6DPROTvyJTE01N5boIhxJ9s+S202Vem/k7aTQOYE Az+bRe5mVZNxTJusO6uyDxfJIE= X-Received: by 2002:a05:600d:8497:20b0:49c:fa21:e73f with SMTP id 5b1f17b1804b1-49e619c0782mr41470565e9.21.1789139492133; Fri, 11 Sep 2026 08:11:32 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:70:b4c3:b236:31c3:c7b1:8cc7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49e6576122bsm65767975e9.2.2026.09.11.08.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2026 08:11:31 -0700 (PDT) Message-ID: <09325e1fd009ed9ebfbadd8d6be703c51137c1ed.camel@cybertec.at> Subject: Re: BUG #19682: Unable to drop a user with default privileges revoked From: Laurenz Albe To: Sylvain PERRAUD Cc: pgsql-bugs@lists.postgresql.org Date: Fri, 11 Sep 2026 17:11:30 +0200 In-Reply-To: <1852627963.39112866.1789112747804.JavaMail.zimbra@grandlyon.com> References: <19682-21342a50fcf153e5@postgresql.org> <1852627963.39112866.1789112747804.JavaMail.zimbra@grandlyon.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.60.2 (3.60.2-1.fc44) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2026-09-11 at 09:45 +0200, Sylvain PERRAUD wrote: > De: "Laurenz Albe" > > On Wed, 2026-09-09 at 09:29 +0000, PG Bug reporting form wrote: > > > PostgreSQL version: 18.4 > > > > > > Scenario 1 : create a user alpha then grant default privileges to him= self > > > > > > test=3D# create user alpha; > > > > > > test=3D# ALTER DEFAULT PRIVILEGES FOR ROLE alpha GRANT ALL ON TABLES= to alpha; > > > > > > test=3D# \ddp alpha > > > Default access privileges > > > Owner | Schema | Type | Access privileges > > > -------+--------+------+------------------- > > > (0 rows) > > > > > > test=3D# drop user alpha; > > > > > > Conclusion 1 : Drop is working > > > > Right, because the ALTER DEFAULT PRIVILEGE did nothing. >=20 > >=20 > Ok I understand but in this situation, why \ddp is not showing access pri= vileges > "alpha=3DarwdDxtm/alpha+" like in scenario 3 ? How can we know the hard-w= ired default > privileges if \ddp is not showing anything. Even the view pg_catalog.pg_d= efault_acl is empty Exactly. Initially, there is a NULL in the system catalog, so you see noth= ing in \ddp, which means "default default privileges". See the documentation for a description of all that: https://www.postgresql.org/docs/current/ddl-priv.html Your statement was a no-operation, so nothing changed in the system catalog= . In scenario three, there were additional ACL items, so it was no longer the= default value. > > > Scenario 2 : create a user alpha then revoke default privileges from = himself > > > > > > test=3D# create user alpha; > > > > > > test=3D# ALTER DEFAULT PRIVILEGES FOR ROLE alpha REVOKE ALL ON TABL= ES FROM alpha; > > > > > > test=3D# \ddp alpha > > > Default access privileges > > > Owner | Schema | Type | Access privileges > > > -------+--------+-------+------------------- > > > alpha | | table | (none) > > > (1 row) > > > > > > 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 ro= le alpha > > > > > > Conclusion 2 : Drop is not working > > > > Right, because now there are changed default privileges (an entry in pg= _default_acl), > > which prevents dropping the role. >=20 > >=20 > So the error message is confusing. It says "owner of default privileges o= n new > relations belonging to role alpha" and \ddp is showing "(none)" in acess = privileges.=20 The error message is correct. There is an empty ACL owned by "alpha", whic= h prevents you from dropping the role. You have to drop that empty ACL. > So how can we guess that we should grant default privileges (ALTER DEFAUL= T PRIVILEGES > FOR ROLE alpha GRANT ALL ON TABLES to alpha) to be able to drop the role = ? You don't have to guess. You modified the default privileges by dropping the ACL item for the table = owner. So you need to grant it again to restore the default. > > > Scenario 3 [...] > > > > >=20 > Here again it is confusing. When we are in this situation : >=20 > test=3D# \ddp alpha > Default access privileges > Owner | Schema | Type | Access privileges > -------+--------+-------+---------------------- > alpha | | table | alpha=3DarwdDxtm/alpha+ > | | | beta=3DarwdDxtm/alpha >=20 > We can think that we should revoke default privileges for both users alph= a and > beta to be able to drop role alpha. But if we revoke default privileges f= or > user alpha, then we are like scenario 2 and drop is not working. Sure. That's because you are thinking wrongly. By default, the object own= er *does* have privileges on the table, so you shouldn't revoke that to restor= e the default. I'm not saying that all this is evident. It is complicated, and you should= spend some time with the documentation and experiment. But there is no bug here, so you are on the wrong list. The pgsql-general is more appropriate when you are asking for advice. Yours, Laurenz Albe