Re: Need a command to take the backup of the child tables along with its master table.

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Ron <ronljohnsonjr(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Need a command to take the backup of the child tables along with its master table.
Date: 2019-01-24 12:35:03
Message-ID: CA+bJJbz+s1xbw53xW5WtLFBhiLVOJANnrHqJ4w0148QU+d6g5w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 24, 2019 at 11:01 AM Ron <ronljohnsonjr(at)gmail(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Raghavendra Rao J S V 2019-01-24 12:46:22 How duplicate values inserted into the primary key column of table and how to fix it
Previous Message Thomas Kellerer 2019-01-24 12:17:52 Re: Casting Integer to Boolean in assignment