Re: Finding all References to a Primary Key

From: Erik Jones <erik(at)myemma(dot)com>
To: Matthew T(dot) O'Connor <matthew(at)zeut(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Finding all References to a Primary Key
Date: 2008-03-27 15:24:39
Message-ID: 00F59014-2C8B-49D6-8ED8-57C34AC7ADF7@myemma.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Mar 26, 2008, at 1:19 PM, Matthew T. O'Connor wrote:
> I'm sorry if this is has been discussed, but I tried to find the
> answer in the archives and failed, so...
>
> How do I find all the rows in other tables that reference a specific
> row in another table? I'm only trying to find rows that are in
> tables where there is a Foreign Key referencing the primary key of
> the table in question.
>
> Example:
> Table People has a primary key of people_id
> There are say 20 tables that have foreign keys referencing
> people.people_id
> How do I find all the rows in all of those 20 tables that reference
> a particular person in the people table?

pg_catalog.pg_constraint has that info.

Erik Jones

DBA | Emma®
erik(at)myemma(dot)com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Craig Ringer 2008-03-27 18:02:31 Re: link to Jsp
Previous Message Shavonne Marietta Wijesinghe 2008-03-27 14:47:51 link to Jsp