From: Andrus <kobruleht2@hot.ee>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: How to restore roles without changing postgres password
Date: Wed, 12 Feb 2020 00:26:50 +0200
Message-ID: <38D406CB287140A49F635258B634E072@dell2> (raw)
Hi!
How to create backup script which restores all roles and role memberships
from other server without changing postgres user password.
I tried shell script
PGHOST=example.com
PGUSER=postgres
PGPASSWORD=mypass
export PGHOST PGPASSWORD PGUSER
pg_dumpall --roles-only --file=globals.sql
psql -f globals.sql postgres
but this changes user postgres password also.
How to restore roles so that postgres user password is not changed on
restore.
Script runs on Debian 10 with Postgres 12
Server from where it reads users runs on Debian Squeeze with Postgres 9.1
Andrus
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-docs@postgresql.org
Cc: kobruleht2@hot.ee, pgsql-general@postgresql.org
Subject: Re: How to restore roles without changing postgres password
In-Reply-To: <38D406CB287140A49F635258B634E072@dell2>
* 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