Suppose a dump is provided from pgdumpall

pg_dumpall > outfile.bkp

How to verify if the outfile is a vaild database file for restoration. Just as a precautionary step before restoring it like

psql -f outfile.bkp postgres

For example: In MySQL we can head first few lines of the backup files produced from mysqldump for having SQL like syntax.

  • 1
    If pg_dumpall did not result in an error you can be certain the file is valid.
    – user1822
    Sep 11, 2019 at 12:39
  • What if it is provided by application team and System DBA has to restore it Sep 11, 2019 at 12:58

1 Answer 1


The command you show generates a text backup file. You can use "head" or "less" on it to verify that it looks like a PostgreSQL text backup file, same as mysql. I'd also run "tail", just to make sure it didn't get truncated. It should end with a sign-off like:

-- PostgreSQL database dump complete

-- PostgreSQL database cluster dump complete

Of course to be really sure, you would just set up a dummy database server, and restore it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.