PostgreSQL – Change pg_dump Directory Output to Table Name

dumppg-dumppostgresql

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.

Best Answer

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?