3

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.

1 Answer 1

2

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?

3
  • Changing the file names according to --list/-l will affect pg_restore ?
    – Nir
    Jul 29, 2018 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, 2018 at 16:26
  • While technically correct, the problem remains unsolved. "What is <table name> is not a legal filename on your filesystem" is an interesting idea that could have had a workaround, as every system has had to deal with. Is there no way to get table names from these obscure object-ids?
    – Otheus
    Aug 22 at 8:50

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.