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 1wGR5w-006DVd-2F for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Apr 2026 00:42:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wGR5u-0080cJ-2o for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Apr 2026 00:42:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wGR5u-0080c7-11 for pgsql-hackers@lists.postgresql.org; Sat, 25 Apr 2026 00:42:02 +0000 Received: from mail-oa1-x34.google.com ([2001:4860:4864:20::34]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wGR5r-00000002eg9-31gR for pgsql-hackers@postgresql.org; Sat, 25 Apr 2026 00:42:01 +0000 Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-42c0b0ffac1so3103200fac.2 for ; Fri, 24 Apr 2026 17:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1777077719; cv=none; d=google.com; s=arc-20240605; b=jwdV0eWFo97RtnHFgi1xXEvFfs22JSgQlDQ+VLcuSELCBeMQbhhPwsLXn9LAmjQMk6 83kW9+9/dFcoV3+KwUki8/QoiTUw2O3npJOXqLgcAKRI/PnnloiG+LhuzBAbxu8Finfs aPtoqcPYau1Daxu36RiEUwyWayoUi59FdQXm5FHy8U23E5ZeZqGOQCMSk6UUOY6tpsf9 qG/+X+x499RPYajrnk2A12Ob0s5SZ65gp5wIYtHxU6vL8G2JTbtFdwH8VfnODzKqGZ4n QTs+zWZLJ/GnMK1vKs3CBXVJ7en6syrL4S0fsI2zRZHxxh9dJg6Ck2NyeqXhv8GVHHGh fsTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=DJD9Ma4vNci+WGFE27bM7WM24B6TTj7dQqxlFPVKixI=; fh=VcQm7k6bjQteW29597nGLPOcaCNNhvrjrUfNVSOVa54=; b=a8SUiu0ZW4aMseV8OWC10GAWdkm80ijM7BqMdhGXm8D6DkqI66arCpOXTCSvdlZpwv btEKuZFvXZUs9El093x4AnM7fBRVqtBDdZNmzAr4XnPD9uB+ORmRK6ttmPI06qDhLhSg fOi3ZvXGwsmT1thXUsQ+/ZBAComyC7qDCyr80x+aFMdMzlXzCU+J4desKU0HQAC6L3hN tPrOEC31KhYC1t2lv/JyD49Vq83YBt9k8TMzSIVW58u8w0/pdIlZPcz6IUK2AIweYRBd VzwwEB1iEOnZs0ukclfgXMjvUvHCqnYhF3bnSwBNT3oAW4ZT3izd/1X2HI4ptgX2fHHF ZyUQ==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777077719; x=1777682519; darn=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=DJD9Ma4vNci+WGFE27bM7WM24B6TTj7dQqxlFPVKixI=; b=VlyDkZMxxxWyAryxJzK1CphqtWc1+dfa2mabhefnoZIz+0hdSIJxwPnYYR86b06NWU kwEZ4N837pCPC+qJY8xx5KwE7qmguoI7DKx6IXWtMnK9nuFrv9pqTY7Cmvy7mPDeWUGc Drq+nSXSayQSSJUhUmyAnMiI8tPH55GYZrKiplRc4BmJM1eL3ZKq6/XHTgBoBKPpWC56 HwKUTeGpVa7SXzFmi96ocvfpPKTwZqcmcKOHFnqKW/pmkxDntMmSXDV0MvBQjXdXv9q5 8yzsyjAtIsnjA/BVJaMqRX0u1qa843NTryJ2JcTU4n5IoYcbcDuH+I73GdFASPMxM5h8 h3FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777077719; x=1777682519; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DJD9Ma4vNci+WGFE27bM7WM24B6TTj7dQqxlFPVKixI=; b=cDIle29oxTY1ulIvdbALlmkAAvfqGIcJ6FTLMiCPTqKY0vZZdDttk1aTjscCWL4ttJ kEFE8uVYsCgJapACRIaE4P6DMGCYlDubHAtsQ5ZFrsH1embivc3ijuRPrC0+he2LWbny iIhnMFDEYE/bRbQcmiS/b+o4u6ZsRBp1RXtBY42/aPaa00YjlMTNIZGv5ZovyQLzW+A/ oEaXXUXKX3YQR4wdl5y1tL3EV5OlFxWwx69eHSejbTr5woFY+Sk3pwqMy31MMUm98eiV QSri35qJw8JeUDZw2mgpLT4xdx8P3GKweScfpQOCDpjeJWvN5m4sV1EIP5YcUQ74KvHl SMAw== X-Gm-Message-State: AOJu0YwLmtpssjMCfgv/7GZgT/63Qa8i1BnA9LhOO+2YaIpY9dzoYIr6 cuiEgRztap6CktcKAH7SgRD2i/WvnHvKWYB4tyjIclnHsRmP/9+514gO1gdnp/GqRnCbDbwpOVe 5INbWKgmj1/7oVAHmMzyK/Kc9o2j9aG40cj1x7UM= X-Gm-Gg: AeBDieugG7SxoogsVQFkzGZJX/oCKyzCJbRKdpAqYwKjEYGeRcYF6h6B8LnTz9UtfIl xAf+U4Bw0JbqaqT/E0W1PAxWMkucOcUEItIqtqFqbGSzx/kyw/HnhblNI/AuejfAczkXSKHmYEI jMjoiStsK4kO2NzEiOo5NyqXT9KznuMWv2FHJKiI9wr+9GPV9E4cHrjziWwjQkow2z1QF0RUrJq f7trQEUN7pzYjsBKikx39nasvlF5e3s5nvv0bUd+5lHqAt3s5pwcT4x+wAHuJbm3lc0oK3/GoKl tyC0cApwmXwOLn+LZO0kIdDWrq9hFOOJF9Oh/8AE8HdNFVo9Rkw= X-Received: by 2002:a05:6870:9109:b0:42c:f89:7555 with SMTP id 586e51a60fabf-42c0f89783cmr12100751fac.11.1777077719493; Fri, 24 Apr 2026 17:41:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Zach Manifold Date: Fri, 24 Apr 2026 17:41:50 -0700 X-Gm-Features: AQROBzAPT4tvrmeAaoF_PnQAxqe4YS3ClxZOJiIq9yzx8X-KUcruRe_-Nfpoipo Message-ID: Subject: Re: Proposal: DROP ROLE ... REASSIGN OWNED TO ... To: Robert Haas Cc: pgsql-hackers@postgresql.org Content-Type: multipart/alternative; boundary="00000000000035722806503e2638" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000035722806503e2638 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > If we add a bunch of stuff like this, it will > take work to maintain, but most users won't be able to remember all > the variations that exist at the moment when they might benefit from > them. That's a fair point. I agree the value add is fairly minimal, since my intention was a tiny quality of life enhancement, but to your point if there are different variations of doing the same thing it can either end up being confusing or not utilized. Thanks for reviewing. - Zach Weaver On Fri, Apr 24, 2026 at 5:29=E2=80=AFPM Robert Haas = wrote: > On Thu, Apr 23, 2026 at 2:59=E2=80=AFAM Zach Manifold > wrote: > > My one concern is the possible failure mode - is it possible for > > the reassignment to work but the role to fail to drop? Is this > > preventable? I'm not sure how to "cleanly" approach this type > > of safety where I can assure that both of these operations > > must succeed rather than reassigning ownership and failing > > to drop a role. > > There's no problem of this type -- the whole statement would execute > as a single transaction, and any failure would role the whole thing > back. > > But I'm a little bit skeptical of the underlying proposal for related > reasons. This doesn't really let you do anything that you can't easily > do already: > > rhaas=3D# create role joe; > CREATE ROLE > rhaas=3D# begin; > BEGIN > rhaas=3D*# reassign owned by joe to fred; > REASSIGN OWNED > rhaas=3D*# drop role joe; > DROP ROLE > rhaas=3D*# commit; > COMMIT > > This would fail if the user to be dropped owned objects in another > database, but your hypothetical version of DROP ROLE would have that > issue, too. Even if you couldn't wrap both commands in a single > transaction -- we have some DDL commands that are like that -- running > them one after another wouldn't lose much. So I'm just not sure I > really see the point. If we add a bunch of stuff like this, it will > take work to maintain, but most users won't be able to remember all > the variations that exist at the moment when they might benefit from > them. We might also end up with a patchwork where some things are > supported and seemingly related things are not supported, just because > of the idiosyncrasies of what got implemented and what didn't. I'm not > saying nobody would ever benefit from something like this -- probably > some people would -- but I don't know that there would be all that > many of them or that the benefit would be all that much. > > -- > Robert Haas > EDB: http://www.enterprisedb.com > --00000000000035722806503e2638 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> If we add a bunch of stuff like this, it will
> take work to maintai= n, but most users won't be able to remember all
> the variations that exist at the mom= ent when they might benefit from
> them.

That's a fair point. I agr= ee the value add is fairly minimal, since my
intention was a tiny= quality of life enhancement, but to your point
if there are diff= erent variations of doing the same thing it can either
end up bei= ng confusing or not utilized.

Thanks for reviewing= .

- Zach Weaver

On Fri,= Apr 24, 2026 at 5:29=E2=80=AFPM Robert Haas <robertmhaas@gmail.com> wrote:
On Thu, Apr 23, 2026 at 2:59=E2=80=AFAM= Zach Manifold <zachlweaver00@gmail.com> wrote:
> My one concern is the possible failure mode - is it possible for
> the reassignment to work but the role to fail to drop? Is this
> preventable? I'm not sure how to "cleanly" approach this= type
> of safety where I can assure that both of these operations
> must succeed rather than reassigning ownership and failing
> to drop a role.

There's no problem of this type -- the whole statement would execute as a single transaction, and any failure would role the whole thing
back.

But I'm a little bit skeptical of the underlying proposal for related reasons. This doesn't really let you do anything that you can't eas= ily
do already:

rhaas=3D# create role joe;
CREATE ROLE
rhaas=3D# begin;
BEGIN
rhaas=3D*# reassign owned by joe to fred;
REASSIGN OWNED
rhaas=3D*# drop role joe;
DROP ROLE
rhaas=3D*# commit;
COMMIT

This would fail if the user to be dropped owned objects in another
database, but your hypothetical version of DROP ROLE would have that
issue, too. Even if you couldn't wrap both commands in a single
transaction -- we have some DDL commands that are like that -- running
them one after another wouldn't lose much. So I'm just not sure I really see the point. If we add a bunch of stuff like this, it will
take work to maintain, but most users won't be able to remember all
the variations that exist at the moment when they might benefit from
them. We might also end up with a patchwork where some things are
supported and seemingly related things are not supported, just because
of the idiosyncrasies of what got implemented and what didn't. I'm = not
saying nobody would ever benefit from something like this -- probably
some people would -- but I don't know that there would be all that
many of them or that the benefit would be all that much.

--
Robert Haas
EDB: http://www.enterprisedb.com
--00000000000035722806503e2638--