Re: Feature bug dumpall CREATE ROLE postgres

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-28 22:31:18
Message-ID: 8663cc11-4a1c-68fa-d950-fdc863f28f4b@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On 2024-02-27 Tu 15:12, Tom Lane wrote:
> 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.
>
>

What if we just skip creating the role if it's the bootstrap superuser
in the source and has the same name as the bootstrap superuser in the
destination, using some DO processing?

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-02-28 22:36:13 Re: Feature bug dumpall CREATE ROLE postgres
Previous Message Jim Wilson 2024-02-28 17:25:34 Re: Feature bug dumpall CREATE ROLE postgres