0

We have one master table and multiple child tables (dependent tables) associated with it.

While taking the backup of the master table , I would like to take the backup of all its child (dependent) tables backup also.

Please guide me how to take the backup of the maste table and its dependent tables using pg_dump commad.

  • Is the parent/child relationship in the "foreign key" sense, or the "partitioning/inheritance" sense? – jjanes Jan 24 at 16:45
  • Parent child relationship exists due to foreign key. – Raghavendra Jan 25 at 0:32
0

You can specify multiple tables to "pg_dump" by specifying multiple "-t" flags.

If you are hoping to specify only one "-t" flag and have pg_dump automatically include all the dependent tables, that is not a feature pg_dump has. You will have to enumerate the tables yourself, either manually or by querying the system catalogs. I can't give you the query, because your question is not well defined. We don't know how you want to handle recursive dependents or cross-dependencies, for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.