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.94.2) (envelope-from ) id 1tl9MF-009gR6-FO for pgsql-general@arkaria.postgresql.org; Thu, 20 Feb 2025 16:25:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tl9ME-009QNa-1q for pgsql-general@arkaria.postgresql.org; Thu, 20 Feb 2025 16:25: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.94.2) (envelope-from ) id 1tl9Is-009Ioc-AD for pgsql-general@lists.postgresql.org; Thu, 20 Feb 2025 16:21:34 +0000 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tl9Iq-001zQD-0l for pgsql-general@lists.postgresql.org; Thu, 20 Feb 2025 16:21:34 +0000 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-72720daed05so568193a34.2 for ; Thu, 20 Feb 2025 08:21:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740068490; x=1740673290; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=fKWx/eq2g8reAjw8TdAY/+VjxI9JTETWN7E1p/+ZpKY=; b=W1Ldu6Lxj/K5AyMJ7mHNSLv4DOox5MlKMRVIFDLyzSpK8hnS8SUvD1R84Rk05PxTEV IzIQ5kU5PhnbCqeldMOe0Q9xKYHV/OEjRzpJ2cK/hNxQoNN3VU7W3N4xp+b9UDh6LWup vf6QDMN88kbY/3GymsX/VFSQWwSa22JdtuhhZLp4Q+oZRK2VpWPzUboBTeKjWrPq/DFG velDNa2apDgqh6srFIXJfOUtYqnNSGixtTyFK8mFRv1oczYqqFmQO5R7jmESSrppqVUM wE09FJnMlTKovKTM5+q7FGrjZVzNXQPAS0ZDq2lhGrefpkgssP55KlbOYPlmkNfW3B2W v9YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740068490; x=1740673290; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fKWx/eq2g8reAjw8TdAY/+VjxI9JTETWN7E1p/+ZpKY=; b=qAcDBw0xorqJO1AhDm9PwMa9OyhqRwMWKj6fQ4YgQ8l/ZdGOibQ11xC/GQZzXSVVSs hzAwrmh9+9xv6jpG+EsAR+yjPqKM4L3F/kzrNDK+NAssMeL1Gnxyr1hQFOjENffQNyqP R1xT54bAdpmDGcyoIrYPrRo32qwNSR2/auaBULQ+i5Dc0X4QqSXbAQJ2VlcCpMrD13td 3R3kDg9JY7F5BPhhsospecR1Nd7/eC9zQdEJjkisjnapbBqiC5QShmeh/HcUg6N+1pD9 jG3f7TIObDn7sLIickNBtFncb5Ay4njZW7GquD2qTljndUrjOA0pp6LCeNHdoUqSHdop s4LA== X-Forwarded-Encrypted: i=1; AJvYcCV6nUdr8CengiWThE6H14KgeT2Qvswma4hy72yTxrW140TEn2nLIr4cPO8TCS4LpZ2I2d8xkaMxxErT8mUt@lists.postgresql.org X-Gm-Message-State: AOJu0YzJqDTvxRMIm7s0OFENJvmycZM6Y5UIziHdi1mJBJS/FX+veZob M1LzEJIYTxLhjaylAkYB1rx2t4IMaBcxqQHFNoMUZgwOAQwXcGqpz9W4RChwtTHpGhZAmeQhdgM fvMeGvuUNijw89z9IfQxOdSAd1b4= X-Gm-Gg: ASbGncvKcdp+Aq/fGNWQqYa+IWNhtY8kgvvOZuGEuFi4t6AdasZtOtCWZ2VY6MPwo1A o4hiqRn8wlNiQphaKiVtc5mOTBfc7xohPZ/QI8xzz1GYEV70vdTuqAyaxJvlp7H3PIFwqjWHJxe 0= X-Google-Smtp-Source: AGHT+IFS/1BTeBId5SWVmQ7dHUxvQaYpn4r94ARs32Uzn0yQyuPnZUPL+tDUgi8RmR8BL0VQEJ3xNIqQVCeJbm5DBmg= X-Received: by 2002:a05:6830:65c4:b0:727:876:c83e with SMTP id 46e09a7af769-7273777aa27mr7588772a34.15.1740068490218; Thu, 20 Feb 2025 08:21:30 -0800 (PST) MIME-Version: 1.0 References: <2705563.1740067550@sss.pgh.pa.us> In-Reply-To: <2705563.1740067550@sss.pgh.pa.us> From: Dominique Devienne Date: Thu, 20 Feb 2025 17:21:13 +0100 X-Gm-Features: AWEUYZktShcIN_5-kkw6PQyDHsbLlqsAGal7XpE84kGB818kkYHNp9C4EBFwyE0 Message-ID: Subject: Re: DROP ROLE as SUPERUSER To: Tom Lane Cc: "David G. Johnston" , "pgsql-general@lists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000003e9490062e954478" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003e9490062e954478 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Feb 20, 2025 at 5:05=E2=80=AFPM Tom Lane wrote: > "David G. Johnston" writes: > > On Thursday, February 20, 2025, Dominique Devienne > > wrote: > >> Hi. Today I was surprised that REVOKE ALL ON DATABASE FROM ROLE silent= ly > >> did nothing, even with CASCADE, when I was running it as SUPERUSER, > >> preventing DROP'ing the ROLE. I had to manually SET ROLE to the > GRANTOR, do > >> the REVOKE, which DID something this time, and then I could DROP the > role. > > > This has nothing to do with power/permissions. It is about not > specifying > > =E2=80=9Cgranted by=E2=80=9D in your SQL command and thus failing to fu= lly and correctly > > specify the single permission you want to revoke. > > It used to be that if a superuser issued GRANT/REVOKE, the operation > was silently done as the owner of the affected object. That was > always a bit of a wart, since among other things it meant that the > object owner could undo it. Now you have to say "GRANTED BY " > to get that effect. I'm not entirely sure, but I think this is closer > to what the SQL standard says. > I wasn't aware of GRANTED BY, thanks for that. But that's not much better. It's basically like the SET ROLE to the GRANTOR I did. I guess what I want is GRANTED BY ANYONE! And not have to figure out GRANTOR(s). Also, note that GRANTOR is not even the owner of the DATABASE in my case. --DD --0000000000003e9490062e954478 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Feb 20, 2025 at 5:05=E2=80=AFPM T= om Lane <tgl@sss.pgh.pa.us> = wrote:
"David G. Johnston" <david.g.johnston= @gmail.com> writes:
> On Thursday, February 20, 2025, Dominique Devienne <ddevienne@gmail.com>
> wrote:
>> Hi. Today I was surprised that REVOKE ALL ON DATABASE FROM ROLE si= lently
>> did nothing, even with CASCADE, when I was running it as SUPERUSER= ,
>> preventing DROP'ing the ROLE. I had to manually SET ROLE to th= e GRANTOR, do
>> the REVOKE, which DID something this time, and then I could DROP t= he role.

> This has nothing to do with power/permissions.=C2=A0 It is about not s= pecifying
> =E2=80=9Cgranted by=E2=80=9D in your SQL command and thus failing to f= ully and correctly
> specify the single permission you want to revoke.

It used to be that if a superuser issued GRANT/REVOKE, the operation
was silently done as the owner of the affected object.=C2=A0 That was
always a bit of a wart, since among other things it meant that the
object owner could undo it.=C2=A0 Now you have to say "GRANTED BY <= owner>"
to get that effect.=C2=A0 I'm not entirely sure, but I think this is cl= oser
to what the SQL standard says.

I wasn&#= 39;t aware of GRANTED BY, thanks for that.

But tha= t's not much better. It's basically like the SET ROLE to the GRANTO= R I did.
I guess what I want is GRANTED BY ANYONE! And not have t= o figure out GRANTOR(s).

Also, note that GRANTOR i= s not even the owner of the DATABASE in my case. --DD
--0000000000003e9490062e954478--