Re: dependency ?

From: Brian Wipf <brian(at)clickspace(dot)com>
To: TWENGER2(at)wi(dot)rr(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: dependency ?
Date: 2007-01-29 21:14:17
Message-ID: D38DE415-07D2-4D2A-B8EF-62FE156EEC8C@clickspace.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 29-Jan-07, at 1:06 PM, TWENGER2(at)wi(dot)rr(dot)com wrote:
> I was wondering if there is any way to use psql to list tables that
> are dependent to a specific table. Instead of going through every
> table
> in my database and looking for foreign keys, can I somehow get an
> entire
> list of these dependent tables? Any help would be much
> appreciated, thanks!

You could do this easily enough in the shell. For example, If I
wanted to find all tables that reference foo_table:

psql -U postgres database_name -c '\d *' | egrep "(Table |REFERENCES
foo_table)" | grep -B1 'REFERENCES foo_table' | grep 'Table ' | cut -
d '"' -f 2

should do the trick.

Brian Wipf

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Oleg Bartunov 2007-01-29 21:22:22 Re: "simple" dict with stop words in tsearch2
Previous Message Pierre Thibaudeau 2007-01-29 21:12:43 "simple" dict with stop words in tsearch2