pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nikhil Shetty <nikhil.dba04@gmail.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Modify Bootstrap user ID
Date: Wed, 21 Feb 2024 13:39:18 -0500
Message-ID: <95373.1708540758@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFpL5Vy7qb3SsvbkTJ+WV7E0bNMWoXCDiupbDQgr1Fgpdk7pcg@mail.gmail.com>
References: <CAFpL5Vy7qb3SsvbkTJ+WV7E0bNMWoXCDiupbDQgr1Fgpdk7pcg@mail.gmail.com>

Nikhil Shetty <nikhil.dba04@gmail.com> writes:
> We want to upgrade a postgres v13 database to v16. but the bootstrap user
> used to initialise the database for both are different
> Can we update the bootstrap user for v13 ? like assign oid as 10 in
> pg_authid?

Do not try to change role OIDs --- you will certainly miss some
places where the OID appears.  You can rename it though.

You might have tried this:

regression=# alter user postgres rename to pgsql;
ERROR:  session user cannot be renamed

but it's easy to get around that:

regression=# create user joe superuser;
CREATE ROLE
regression=# \c - joe
You are now connected to database "regression" as user "joe".
regression=# alter user postgres rename to pgsql;
ALTER ROLE
regression=# \c - pgsql
You are now connected to database "regression" as user "pgsql".
regression=# drop user joe;
DROP ROLE

			regards, tom lane





view thread (4+ messages)  latest in thread

Message-ID: <95373.1708540758@sss.pgh.pa.us>
Permalink:  ../95373.1708540758@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/95373.1708540758@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, nikhil.dba04@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Modify Bootstrap user ID
  In-Reply-To: <95373.1708540758@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox