Can I selectively back up a Postgres database using only certian tables?

Can I programmatically (or whatever method works) create a backup of the database, only with the tables that I want? I have about 100 tables in my database, and I only need 10 table backups (of course, they are all interdependent). How can i achieve this? And by the way, I have a postgresql database.

+3
source share
1 answer

Of course. pg_dump allows you to pass a list of tables with a parameter-t

To eliminate some doubts. True, the parameter -taccepts only one pattern. But this pattern is very similar to regex, so if you want to dump tables A, B and C, you can do:

pg_dump -t '(A|B|C)' 
+13
source

All Articles