Re: [HACKERS] Dumping database creation options and ACLs - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [HACKERS] Dumping database creation options and ACLs
Date
Msg-id CA+TgmoanhjEzFL1tKuM1X9Nom0HXNLTpi+K9jCe5o_EDPB+0hg@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Dumping database creation options and ACLs  (Adrien Nayrat <adrien.nayrat@dalibo.com>)
List pgsql-hackers
On Thu, Jun 29, 2017 at 12:30 PM, Adrien Nayrat
<adrien.nayrat@dalibo.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



pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: [HACKERS] Default Partition for Range
Next
From: "K S, Sandhya (Nokia - IN/Bangalore)"
Date:
Subject: Re: [HACKERS] Postgres process invoking exit resulting in sh-QUITcore