Re: How to restore roles without changing postgres password

2020-02-12 Thread Tom Lane
Adrian Klaver writes: > On 2/11/20 11:31 PM, Andrus wrote: >> Also I dont understand why GRANTED BY clauses appear in file. This looks >> like noice. >> GRANT documentation >> https://www.postgresql.org/docs/current/sql-grant.html >> does not contain GRANTED BY clause. It looks like pg_dumpall

Re: How to restore roles without changing postgres password

2020-02-12 Thread Adrian Klaver
On 2/11/20 11:31 PM, Andrus wrote: Hi! Thank you. >pg_dumpall creates an SQL file which is just a simple text file >you can then edit sql removing postgres user fromĀ  the file >This can be automated in a script that searches the generated sql file for the postgres userĀ  replacing it with a

Re: How to restore roles without changing postgres password

2020-02-12 Thread Andrus
Hi! >Not a bad idea, would want to extend this to all the roles on the server not >just postgres >I've edited the global dump many times removing/editing table spaces, >comment old users, etc.. Maybe it is easier to create plpgsql procedure which returns desired script as text. Or it

Re: How to restore roles without changing postgres password

2020-02-11 Thread Andrus
Hi! Thank you. >pg_dumpall creates an SQL file which is just a simple text file >you can then edit sql removing postgres user from the file >This can be automated in a script that searches the generated sql file for the >postgres user replacing it with a blank/empty line or adds -- to the

Re: How to restore roles without changing postgres password

2020-02-11 Thread Justin
HI Tom Not a bad idea, would want to extend this to all the roles on the server not just postgres I've edited the global dump many times removing/editing table spaces, comment old users, etc.. On Tue, Feb 11, 2020 at 5:46 PM Tom Lane wrote: > "Andrus" writes: > > How to create backup

Re: How to restore roles without changing postgres password

2020-02-11 Thread Tom Lane
"Andrus" writes: > How to create backup script which restores all roles and role memberships > from other server without changing postgres user password. [ shrug... ] Edit the command(s) you don't want out of the script. This seems like a mighty random requirement to expect pg_dump to support

Re: How to restore roles without changing postgres password

2020-02-11 Thread Justin
pg_dumpall creates an SQL file which is just a simple text file you can then edit sql removing postgres user from the file This can be automated in a script that searches the generated sql file for the postgres user replacing it with a blank/empty line or adds -- to the bringing of the line

How to restore roles without changing postgres password

2020-02-11 Thread Andrus
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