Re: Feature bug dumpall CREATE ROLE postgres

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jim Wilson <jim(at)wreath(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Feature bug dumpall CREATE ROLE postgres
Date: 2024-02-27 21:33:15
Message-ID: CAKFQuwag7VP3Xz=U1xUwCLXo_CGiE5ZBBsjBR+MGhLbvMxP+Ww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Feb 27, 2024 at 1:12 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 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.
>

Why are we catering to the 0.0001 percent here?

Put this in the dumpall file instead of a create role command:
pseudo-code
DO $$
if 10::oid::regrole != 'postgres' then
raise error 'bootstrap superuser is named postgres in source database'
raise error 'either rename your bootstrap superuser to postgres or create a
new superuser named postgres'
end if;
$$;

Or, any chance we can just write:

alter table tbl owner to 10::oid;

and not care what specific label the bootstrap superuser is using?

More simply I suppose is to have an option on pg_dumpall to omit the
bootstrap superuser create role command to at least avoid having people
have to modify the dump file after the fact.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Gena Makhomed 2024-02-27 21:34:10 Re: systemd[1]: postgresql-16.service: Killing process 25992 (postgres) with signal SIGKILL.
Previous Message Tom Lane 2024-02-27 20:12:42 Re: Feature bug dumpall CREATE ROLE postgres