Re: Feature bug dumpall CREATE ROLE postgres

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Wilson <jim(at)wreath(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Feature bug dumpall CREATE ROLE postgres
Date: 2024-02-27 20:12:42
Message-ID: 2149099.1709064762@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Jim Wilson <jim(at)wreath(dot)com> writes:
> Including "CREATE ROLE postgres;" in the dumpall will cause the script to
> throw an error.

I believe the reason pg_dumpall does that is to avoid worse failures
if the target installation has a different bootstrap superuser name
than the source did. One error is easier to ignore than hundreds
of 'em.

We could avoid that problem if we wanted to invent and use CREATE
OR REPLACE ROLE, but that would have downsides of its own, such as
silently overwriting the properties of any roles that already exist
in the target (IOW, the cases where you *want* to get that error).

Maybe it'd work to invent C.O.R.R. but only use it for the bootstrap
superuser, with plain CREATE ROLE for the rest. Haven't really
thought through the consequences of that.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2024-02-27 21:33:15 Re: Feature bug dumpall CREATE ROLE postgres
Previous Message Alvaro Herrera 2024-02-27 18:19:36 Re: BUG #18367: Cannot drop schema