Re: Dumping database creation options and ACLs

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Adrien Nayrat <adrien(dot)nayrat(at)dalibo(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Dumping database creation options and ACLs
Date: 2017-07-03 14:58:37
Message-ID: CA+TgmoanhjEzFL1tKuM1X9Nom0HXNLTpi+K9jCe5o_EDPB+0hg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 29, 2017 at 12:30 PM, Adrien Nayrat
<adrien(dot)nayrat(at)dalibo(dot)com> wrote:
> As reported by Ronan there's no other option than using pg_dumpall to restore
> database options and ACLs.
>
> So, we use this trick to stop pg_dumpall before \connect and then use pg_restore:
>
> pg_dumpall -s | sed -rn '/^\\connect/{q}; p' > database+grants.sql
>
>
> Of course, it is not graceful as we just need results of pg_dumpall -g and what
> the dumpCreateDB() function outputs.
>
> What do you think about adding an option like --createdb-only (as suggested by
> Ronan) for this? I'm not fully satisfied with this name though, I'll be happy
> if you have a better suggestion.
>
> Attached a naive patch.

Note that some progress has been made on the CURRENT_DATABASE thing:

https://www.postgresql.org/message-id/CAF3+xM+xSswcWQZMP1cjj12gPz8DXHcM9_fT1y-0fVzxi9pmOw@mail.gmail.com

I tend to favor that approach myself, although one point in favor of
your suggestion is that adding another flag to pg_dumpall is a heck of
a lot less work to get to some kind of solution to this issue.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message K S, Sandhya (Nokia - IN/Bangalore) 2017-07-03 15:01:31 Re: [HACKERS] Postgres process invoking exit resulting in sh-QUIT core
Previous Message Dilip Kumar 2017-07-03 14:30:21 Re: Default Partition for Range