pg_dump -F d will result in multiple <number>.dat.gz files which represent the object number in the database. I wish pg_dump create those files in the format <table name>.dat.gz instead so I'll be able to easy distinguish a file/table in a case of table recoery.


There is no built in way to do this. You would have to change the code to do what you want. Or you could script something to rename the files based on the output of pg_restore -l .

Whatever you come up with wouldn't be very general. For example, what if <table name>.dat.gz is not a legal file name on your file system?

| improve this answer | |
  • Changing the file names according to --list/-l will affect pg_restore ? – Nir Jul 29 '18 at 15:05
  • Yes. I assumed you didn't want to use pg_restore, but some manual process. If you want to use pg_restore, then you would just use -l and -L to do what you want directly without ever looking at the *.dat.gz flies themselves. You could add symlinks from the table names to the dat.gz files rather than renaming them, if you want to not break pg_restore yet still have an easier way to inspect the files manually. – jjanes Jul 29 '18 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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