Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

back_up_postgresql should create separate dump files for each database #2

Open
mgedmin opened this issue Apr 16, 2015 · 4 comments
Open

Comments

@mgedmin
Copy link
Member

mgedmin commented Apr 16, 2015

back_up_postgresql now uses pg_dumpall and dumps everything into a single file.

I'd prefer to have separate dump files for each database.

@mgedmin
Copy link
Member Author

mgedmin commented Apr 16, 2015

pg_dumpall works by emitting commands to re-create roles, tablespaces, and empty databases, then invoking pg_dump for each database. This means that while each database will be internally consistent, the snapshots of different databases might not be exactly in-sync.
-- http://www.postgresql.org/docs/9.1/static/backup-dump.html

So basically I want sql files for the roles/tablespaces, and then a dump file for each DB. Hmm. pg_dumpall takes -g/--globals-only ("Dump only global objects (roles and tablespaces), no databases."). Good! But I'm a bit unsure about parsing psql -l with shell...

@mgedmin
Copy link
Member Author

mgedmin commented Apr 16, 2015

Perhaps we should also make it possible for the user to specify a desired dump format? Some of them sound quite interesting (directory with a file per table, or a tar of the above).

@mgedmin
Copy link
Member Author

mgedmin commented Apr 17, 2015

Uh, it should be documented that back_up_postgresql only does it for the default cluster (you can have multiple clusters, running different PostgreSQL versions, and OS upgrades often leave it that way!)

@mgedmin
Copy link
Member Author

mgedmin commented Oct 12, 2018

I've changed my mind on dump formats:

pg_restore: [archiver] unsupported version (1.13) in file header

SQL is portable; efficient binary formats from random PostgreSQL versions are apparently not. (This was a dump create with pg_dump -Fc on 9.4, pg_restore was version 10.5.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant