wondering about a little convenience problem of mine atm.
Say I got a database with a variable amount of tables and I want a dump of that database BUT only the table structure and the data of one specific table.
It is, of course, basically possible to do that, but the command would be rather long and I'd have to know all the tables.
But I'd need a command without knowing the names or how many other tables there are, only the one table whose data I want should be relevant, the others are basically just cattle, and in the end I would like to have it all in one file.
Looking forward to reading some suggestions or maybe some pointers on how to solve my problem. Really curious :)
The default pg_dump
output format is a psql
script, so you can just concatenate them:
pg_dump -d my_db --schema-only > dump.sql
pg_dump -d my_db -t my_table --data-only >> dump.sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With