Re: pg_dumpall can't be restored with different bootstrap superuser - Mailing list pgsql-bugs

From Euler Taveira
Subject Re: pg_dumpall can't be restored with different bootstrap superuser
Date
Msg-id fb3f446c-3a5e-40c0-82da-18ce6b81926b@app.fastmail.com
Whole thread
In response to pg_dumpall can't be restored with different bootstrap superuser  (Álvaro Rodríguez <alvaro@datadoghq.com>)
Responses Re: pg_dumpall can't be restored with different bootstrap superuser
Re: pg_dumpall can't be restored with different bootstrap superuser
List pgsql-bugs
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. If you want to share roles and its properties
between clusters, don't use different bootstrap users. If you do so, you should
execute another step between dump and restore to replace the source bootstrap
user with the target bootstrap user or even collect the error messages and
rewrite the affected SQL commands.

I don't think an option to inject arbitrary grantor is acceptable for security
concerns. There isn't a role specification like BOOTSTRAP_USER (similar to
CURRENT_ROLE or SESSION_USER) that would avoid this situation. Maybe we should
add a sentence saying that GRANT on roles requires the same bootstrap user.


--
Euler Taveira
EDB   https://www.enterprisedb.com/



pgsql-bugs by date:

Previous
From: Álvaro Rodríguez
Date:
Subject: pg_dumpall can't be restored with different bootstrap superuser
Next
From: "David G. Johnston"
Date:
Subject: Re: pg_dumpall can't be restored with different bootstrap superuser