pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedNeed a command to take the backup of the child tables along with its master table.
3+ messages / 3 participants
[nested] [flat]
* Need a command to take the backup of the child tables along with its master table.
@ 2019-01-24 09:40 Raghavendra Rao J S V <raghavendrajsv@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Raghavendra Rao J S V @ 2019-01-24 09:40 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
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.
--
Regards,
Raghavendra Rao J S V
Mobile- 8861161425
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Need a command to take the backup of the child tables along with its master table.
@ 2019-01-24 10:01 Ron <ronljohnsonjr@gmail.com>
parent: Raghavendra Rao J S V <raghavendrajsv@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Ron @ 2019-01-24 10:01 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Need a command to take the backup of the child tables along with its master table.
@ 2019-01-24 12:35 Francisco Olarte <folarte@peoplecall.com>
parent: Ron <ronljohnsonjr@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Francisco Olarte @ 2019-01-24 12:35 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Thu, Jan 24, 2019 at 11:01 AM Ron <ronljohnsonjr@gmail.com> wrote:
> 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.
That would be hard. There is an option to make psql show the queries
it uses to implement \d. Reading that it is normally easy to buld a
query which lists the dependents by creative imitation and feed it to
psql ( instead of the \d ) with the approppiate context setting
options to spit the table names, or even the --table="xx" list,
including schemas and other niceties.
And if his shell is not bash, but CMD.EXE or other similar thing,
parsing \d output will be hell.
Francisco Olarte.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2019-01-24 12:35 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-01-24 09:40 Need a command to take the backup of the child tables along with its master table. Raghavendra Rao J S V <raghavendrajsv@gmail.com>
2019-01-24 10:01 ` Ron <ronljohnsonjr@gmail.com>
2019-01-24 12:35 ` Francisco Olarte <folarte@peoplecall.com>
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