pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Need a command to take the backup of the child tables along with its master table.
Date: Thu, 24 Jan 2019 04:01:06 -0600
Message-ID: <51c5a384-4dc5-fd75-62e6-bcbc518dcfc4@gmail.com> (raw)
In-Reply-To: <CAEHH7R7AkyqYgN6iqTn_Q_T-oJBhEfO0q_YmNdSoCjtG61TgDQ@mail.gmail.com>
References: <CAEHH7R7AkyqYgN6iqTn_Q_T-oJBhEfO0q_YmNdSoCjtG61TgDQ@mail.gmail.com>

On 1/24/19 3:40 AM, Raghavendra Rao J S V wrote:
> Hi All,
>
> 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  master table and its 
> dependent tables using *pg_dump *command.
>

Do you know the list of dependent tables?  If so, you can list them in the 
"pg_dump --table=" clause.

If not, you'll have to do some bash magic in parsing the "Foreign-key 
constraints:" clause of "\d your_table_name" and stuff them in the "pg_dump 
--table=" clause.


-- 
Angular momentum makes the world go 'round.

view thread (3+ messages)  latest in thread

Message-ID: <51c5a384-4dc5-fd75-62e6-bcbc518dcfc4@gmail.com>
Permalink:  ../51c5a384-4dc5-fd75-62e6-bcbc518dcfc4@gmail.com/
Also on:    postgresql.org/message-id/51c5a384-4dc5-fd75-62e6-bcbc518dcfc4@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Need a command to take the backup of the child tables along with its master table.
  In-Reply-To: <51c5a384-4dc5-fd75-62e6-bcbc518dcfc4@gmail.com>
  References: <CAEHH7R7AkyqYgN6iqTn_Q_T-oJBhEfO0q_YmNdSoCjtG61TgDQ@mail.gmail.com> <51c5a384-4dc5-fd75-62e6-bcbc518dcfc4@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox