pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Andrus <kobruleht2@hot.ee>
To: Justin <zzzzz.graf@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: How to restore roles without changing postgres password
Date: Wed, 12 Feb 2020 08:39:27 -0800
Message-ID: <91c20b33-cbea-457f-4f43-00a7b8288d7f@aklaver.com> (raw)
In-Reply-To: <4D6B3F5D59EA48A0BF711C8E461D6388@dell2>
References: <38D406CB287140A49F635258B634E072@dell2>
	<CALL-XeNbJ8w_edXjqTuPL0DJv1OdS7WU4z9hMzo71DfAnwMVWg@mail.gmail.com>
	<4D6B3F5D59EA48A0BF711C8E461D6388@dell2>

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 blank/empty line or adds -- 
> to the bringing of >the line which comments it out.
> This script creates cluster copy in every night. So this should be done 
> automatically.
> I have little experience with Linux.
> Can you provide example, how it should it be done using sed or other tool.
> There is also second user named dbandmin whose password  cannot changed 
> also.
> It would be best if  CREATE ROLE and ALTER ROLE  clauses for postgres 
> and dbadmin users are removed for file.

Then we would get all sorts of posts about why they are not showing up 
anymore. This suggestion is a non starter.

> Or if this is not reasonable, same passwords or different role names can 
> used in both clusters.

They can be, you just have to track/manipulate that yourself. What it 
comes down to is that the Postgres project is not the admin for 
everyone's install.

> 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 generates 
> undocumented clause.

It is not noise, see:

~/src/bin/pg_dump/pg_dumpall.cpg_dumpall.c

/*
* We don't track the grantor very carefully in the backend, so cope
* with the possibility that it has been dropped.
*/
                 if (!PQgetisnull(res, i, 3))
                 {
                         char       *grantor = PQgetvalue(res, i, 3);

                         fprintf(OPF, " GRANTED BY %s", fmtId(grantor));
                 }
                 fprintf(OPF, ";\n");


> Andrus.


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (8+ messages)  latest in thread

Message-ID: <91c20b33-cbea-457f-4f43-00a7b8288d7f@aklaver.com>
Permalink:  ../91c20b33-cbea-457f-4f43-00a7b8288d7f@aklaver.com/
Also on:    postgresql.org/message-id/91c20b33-cbea-457f-4f43-00a7b8288d7f@aklaver.com

 · 

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-docs@postgresql.org
  Cc: adrian.klaver@aklaver.com, kobruleht2@hot.ee, zzzzz.graf@gmail.com, pgsql-general@postgresql.org
  Subject: Re: How to restore roles without changing postgres password
  In-Reply-To: <91c20b33-cbea-457f-4f43-00a7b8288d7f@aklaver.com>

* 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