On Thu, Jun 29, 2017 at 12:30 PM, Adrien Nayrat <adrien.nay...@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-0fvzxi9p...@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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers