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 1wKLAW-000s8P-0Y for pgsql-bugs@arkaria.postgresql.org; Tue, 05 May 2026 19:10:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wKLAV-00DXPc-0N for pgsql-bugs@arkaria.postgresql.org; Tue, 05 May 2026 19:10:55 +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 1wKLAU-00DXOj-2q for pgsql-bugs@lists.postgresql.org; Tue, 05 May 2026 19:10:54 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wKLAS-00000000MZM-1lCJ for pgsql-bugs@lists.postgresql.org; Tue, 05 May 2026 19:10:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 645JAl85671135; Tue, 5 May 2026 15:10:47 -0400 From: Tom Lane To: "Euler Taveira" cc: =?UTF-8?Q?=C3=81lvaro_Rodr=C3=ADguez?= , pgsql-bugs@lists.postgresql.org, "Javier Maellas" , "Diego Revenga" , Nathan Bossart Subject: Re: pg_dumpall can't be restored with different bootstrap superuser In-reply-to: References: Comments: In-reply-to "Euler Taveira" message dated "Tue, 05 May 2026 15:23:01 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <671133.1778008247.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Tue, 05 May 2026 15:10:47 -0400 Message-ID: <671134.1778008247@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Euler Taveira" writes: > On Tue, May 5, 2026, at 7:51 AM, Álvaro Rodríguez wrote: >> We have hit an issue with pg_dumpall --roles-only where the role grants >> to other roles can't be reapplied in a clean database, if the bootstrap >> superuser does not have the same name in both databases. > This is not a bug. There is no way that pg_dumpall knows that the bootstrap > user you want is another one. I don't think that pg_dumpall is to be blamed; this is the backend's fault. I thought we had made this better in dd1398f13, but it still seems rather bogus: regression=# create user super with superuser; CREATE ROLE regression=# create user a; CREATE ROLE regression=# create user b; CREATE ROLE regression=# grant a to b granted by super; ERROR: permission denied to grant privileges as role "super" DETAIL: The grantor must have the ADMIN option on role "a". Surely a superuser should be considered to have admin options on everything. Even more bogus, compare these results: regression=# \c - super You are now connected to database "regression" as user "super". regression=# grant a to b granted by super; ERROR: permission denied to grant privileges as role "super" DETAIL: The grantor must have the ADMIN option on role "a". regression=# grant a to b; GRANT ROLE Anyone would think that "GRANTED BY current_user" has the same effect as omitting the clause, but here it doesn't. So it seems to me that we're missing a superuserness check somewhere in this, but I'm not entirely sure which bit of code to blame. I agree that the answer for existing branches is probably going to be "so don't do that", but maybe we can improve this in v19 or later. regards, tom lane