pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthew T. O'Connor <matthew@zeut.net>
To: pgsql-sql@postgresql.org
Subject: Finding all References to a Primary Key
Date: Wed, 26 Mar 2008 14:19:30 -0400
Message-ID: <47EA93B2.8000206@zeut.net> (raw)

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?


Thank you in advance,

Matthew O'Connor



view thread (2+ messages)  latest in thread

Message-ID: <47EA93B2.8000206@zeut.net>
Permalink:  ../47EA93B2.8000206@zeut.net/
Also on:    postgresql.org/message-id/47EA93B2.8000206@zeut.net

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: matthew@zeut.net
  Subject: Re: Finding all References to a Primary Key
  In-Reply-To: <47EA93B2.8000206@zeut.net>

* 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