I have a database with several tables, let's say table_a
and table_b
.
I want to backup my base using pg_dump
, but (for various reasons) I want each table to have its own dumping file. I could do something like:
$ pg_dump -t table_a -f export_a.sql
$ pg_dump -t table_b -f export_b.sql
but consistency wouldn't be assured: modifications could happens between the two dumps, so my two dumps would represent differents states of the database, which is not consistent.
My question is: Is there any way to ensure these two dumps to be consistent (like, to be in the same transaction or something), or to tell pg_dump
to output each table of a single dump in its own file?
I have tried to use pg_dump -Fd -Z0
, but outputted .dat
don't seem readable enough to separate information of each table.