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 1vw5bm-00283Z-0M for pgsql-bugs@arkaria.postgresql.org; Fri, 27 Feb 2026 21:42:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vw5bj-00749c-0p for pgsql-bugs@arkaria.postgresql.org; Fri, 27 Feb 2026 21:42:47 +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 1vw5bi-00749Q-2z for pgsql-bugs@lists.postgresql.org; Fri, 27 Feb 2026 21:42:46 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vw5bf-00000001ZJM-46Wy for pgsql-bugs@lists.postgresql.org; Fri, 27 Feb 2026 21:42:46 +0000 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-b93718302beso212959466b.3 for ; Fri, 27 Feb 2026 13:42:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772228562; cv=none; d=google.com; s=arc-20240605; b=D/JgPSowhFprWavGbwblkxZg6ZMWz9+5FyGtQOwSQXrzBTWsxtu16HcjZ8dCf4C5GB Yjhkx+e8Bfjp+asvifyv8A7zQIKPmhp+2XVxqvKNn0IyOUNlK75YuaiXWlmzDb2vJhHX z28u8bcUxDoTVUBQcl3BjbU2lkkLoJjehx2NXX9M97z/w0pEe+711XkVEpW+Rwktw367 fmcf0Pl9tMc341kVfYiGwKuukdWkNsgdwYs4Kl4KQVAtqacnQnfyYZOQA66rRYtrfu5r 11mopeYEV91Dhp5dir4TNjvcnL0rI28t6VY5peKF7DDrbc3NBkvIvlw3bUVUTVtsJovq oHWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=BA0y1h9KWykXybMwyhBJ4kEA+XKkWtCiSENb9UGQKLI=; fh=77pj+oPcFLwhm9k86+9zg8v0li/zQ2gdC4hlsXW5B90=; b=GiI5CmIfLfnmkWixeNLVeXbQybwtl5giulGcIwmdN6fn04dya0xWIQFl+1YD99GTqH J0gyCWuV9M5Sik7tnOCoon6mrokAw8kQfkxrPROJIUPY5yoIPAL9jR2O/fEhuQMfPdZK G9AIfAYxQciLxtC8KJCVZUUgHaAJdlu+alBDQT2l3M+h/6GBEkXyhq8M/XwEaHiikntu PbvtCMyjdj4YCSmK6qjmwcO6L3zLyBQdAomtHLzKiNZvwM86ybYulEraZ2twkcHEkcl0 1m2oLRmBAAXGnScHJJgSrmO84B2TYUaYgf5nUet+TrqBEXvG1rhY2oJB9+/up7ab1WL2 W5Jw==; darn=lists.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=20230601; t=1772228562; x=1772833362; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=BA0y1h9KWykXybMwyhBJ4kEA+XKkWtCiSENb9UGQKLI=; b=PbVsyB5oXlls70nkdyhe1fgU1CiIOc0ldvc0H0M+3pDh7NfuT0o1NXWiZ8gqUZDgDg 9NbnfT7Td77+FOvWgpg7gXYl/dXWPDFDrEL4vh40Tiy260uf2lDN5ku2UHIEGlOGcubf WXEdPsQEUbLv8eu5qEqKxiSiXmoIhKDhBKeAshItMCmlo1uJeb2ihf9o/JjA6SAZSCDv HbEPACXPe2/YU/Qn+SFeftqR8Gw2jLqGUojjSax0uXpZnPJl8+quPJCoDZx3kIW9Fngu MkSyDXoJKAfM3BkKcWiv6HYP7cc0kfPg/VNhUMk3SkuL1i8i9a3s/BxGiAOXR0C0X9E1 7mgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772228562; x=1772833362; h=content-transfer-encoding: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=BA0y1h9KWykXybMwyhBJ4kEA+XKkWtCiSENb9UGQKLI=; b=Zx1df2mI+7dinB/nJnX6lVPcEo8ut+Rw+02J2HdFVJeouVyYPL7bd10v9hRCsgTl/B bObH9thuOgPTfIDpESDEZ+uXtY2MNlZveO6OBWd2B1Zhx2VLDtEFCkafAWdhvgWm8SRq UC2TB7ydNiwjMzKRHBAcr3efXyem+5Js+jom9LK/Rz8LMkcNJ5O9BE9PE9IgtaKqqBAD 5h/rbEjr/04jDr5j9HiokuRhR6HjhPiPQFbAs4XDPsKwnc/BUv7pg9taZ/Z9+8nGxkLy o4esw/uYVIDFppjDUbmaUav4I97rZkNs7n8I0c0kIpYoq5BfHluZiJwHGBditoDmMQNM hFWQ== X-Forwarded-Encrypted: i=1; AJvYcCUTw3tktVAdUuTER78BjvpC1P0jq7wQWVZCGmVivRiM1iuBiTEhd9tGYkaUtDdZcEE8yaQV8QNt2iFU@lists.postgresql.org X-Gm-Message-State: AOJu0Yy1CD0OJgtlXRCLtFSdOWL2HT7gNvT65g6QBsZqdh2tSF+k90yh Q9eyxAXkwp/5fc5sAHGxmDKI0ZOmD3neZ78LTgndel9oksNSXg5jvXZlox+tY9JbZh1Elu4qVOY 4ssmtAQvRyMXEsOwUcOlbGfHjqhwJjHI= X-Gm-Gg: ATEYQzwcnGKHJZNMJnxwaCN+sbUrQUk07eT3yWnW2ssfCvejr58TCNDgsT1qVq5aVA+ xbHHGvC7X6KANgL5LdEHi4g2bPSKIuGG6UZpgsA01VoLBMfJ+8A/syuiWmKw3Q9Rr1WLP6m/W2H M8TN8r+0W32v8SGBw5iwwAtEAAin/dVyd0OstOrZZdHO0nAtigW7FtmD6+ON+vwInN1aEi9bWv5 811VCkkZDMNPM+Wxfi/Uq+9xWWyJsGaa5HsZRPFCBZQ3wgOg6Nh54tQfn9S16xmYTfIgSmfRBwn 7YAglBIGMfbUd/ZoOvzQc7gnzfsTupIeHeZWduc= X-Received: by 2002:a17:907:2682:b0:b8f:dce0:dbab with SMTP id a640c23a62f3a-b937636d768mr263641866b.3.1772228562188; Fri, 27 Feb 2026 13:42:42 -0800 (PST) MIME-Version: 1.0 References: <202502131716.7mgkcnrem2hn@alvherre.pgsql> <2939991.1740089974@sss.pgh.pa.us> <179448.1772033773@sss.pgh.pa.us> <265501.1772038216@sss.pgh.pa.us> <296083.1772041154@sss.pgh.pa.us> <301798.1772044229@sss.pgh.pa.us> <304751.1772045891@sss.pgh.pa.us> <1103272.1772227345@sss.pgh.pa.us> <1104379.1772227731@sss.pgh.pa.us> In-Reply-To: <1104379.1772227731@sss.pgh.pa.us> From: Robert Haas Date: Fri, 27 Feb 2026 16:42:30 -0500 X-Gm-Features: AaiRm50kinRviSt0G_OuAaE3po2d__TrDgNp4dO9yTVsGILf-bjL2t0S8S6dSOE Message-ID: Subject: Re: Major Version Upgrade failure due to orphan roles entries in catalog To: Tom Lane Cc: =?UTF-8?Q?=C3=81lvaro_Herrera?= , Virender Singla , pgsql-bugs@lists.postgresql.org, Aniket Jha Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Feb 27, 2026 at 4:28=E2=80=AFPM Tom Lane wrote: > I wrote: > > So I end with the attached draft patch. > > Sigh, this time with it really attached. I suggest that having both a variable called dump_grantor and one called dump_grantors is a little bit subtle, but other than that this looks good on a quick read-through. Regarding this point: > I'm inclined to > think that is an overreaction to the possible unreliability of the > data (and from your comment upthread you might agree). I think this is my code, so I certainly believed I had the right idea at the time, but we could revisit that. One thing to keep in mind is that in v15-, regardless of the notional grantor, in effect all grants are independent of the existence of any other user. In v16+, they form a tree structure, with grants depending on their grantors. So, when upgrading from v15- to v16+, we have to end up with a valid tree structure, but there's absolutely no reason to think that we already have one. If we don't, it must be better to discard the grantor than to fail the dump-and-restore altogether. Note that it's perfectly possible not to have a tree structure, e.g. because we have circular grants, even if all the roles involved still exist and have existed continuously. I believe my thought process at the time was there wasn't really any reason to imagine that whatever we were upgrading from v15- was intended as a tree structure, and therefore it made logical sense to treat it as though all of those grants directly emanated from the superuser, i.e. the tree is just 1 level deep. Now, that does mean losing the grantor information, but we're arguably preserving the semantics, since any it reproduces the v15- state where any of those roles are free to be dropped (assuming no other blockers). Anyway, again, we can rethink that, but if we do it without repairing any structural "tree defects," we'll end up with a dump that we can't reload on v16+. --=20 Robert Haas EDB: http://www.enterprisedb.com