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