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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: kobruleht2@hot.ee
Subject: Re: How to restore roles without changing postgres password
In-Reply-To: <38D406CB287140A49F635258B634E072@dell2>
References: <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