How to restore roles without changing postgres password

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: How to restore roles without changing postgres password
Date: 2020-02-11 22:26:50
Message-ID: 38D406CB287140A49F635258B634E072@dell2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-general

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

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Justin 2020-02-11 22:37:55 Re: How to restore roles without changing postgres password
Previous Message Tom Lane 2020-02-11 21:51:09 Getting our tables to render better in PDF output

Browse pgsql-general by date

  From Date Subject
Next Message Justin 2020-02-11 22:37:55 Re: How to restore roles without changing postgres password
Previous Message Julien Rouhaud 2020-02-11 20:13:41 Re: Query returns no results until REINDEX