pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Roger Motorola <roger77_lb@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: Locating ( FKs ) References to a Primary Key
Date: Wed, 17 Aug 2005 12:06:50 -0700 (PDT)
Message-ID: <20050817190650.93891.qmail@web51904.mail.yahoo.com> (raw)

Hi to all, 

Is there any means by which one can get all Foreign Keys (References) that
'point' to a certain Primary Key for a given table ?

For instance, let's consider those three tables:

(NOTE: table contents here are not deeply thought of...)

// employees table
create table emp
(id serial primary key, 
first_name varchar not null, 
last_name varchar not null, 
.....................etc.);

// employee address
create table emp_address
(emp_id integer references emp (id), 
city integer references city (id), 
primary key (emp_id, city), 
comments varchar not null);

// employee categories ()
create table emp_categories
(emp_id integer references emp (id), 
institution integer references institutions (id),
unique (emp_id, institution), 
category integer references categories (id), 
primary key (emp_id, institution, category), 
description varchar not null);


So, can we issue a query that gets all references to emp.id ?
which should yield here:
    emp_address.emp_id 
and emp_categories.emp_id


Thanks in advance, 
Roger Tannous.


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 



view thread (3+ messages)  latest in thread

Message-ID: <20050817190650.93891.qmail@web51904.mail.yahoo.com>
Permalink:  ../20050817190650.93891.qmail@web51904.mail.yahoo.com/
Also on:    postgresql.org/message-id/20050817190650.93891.qmail@web51904.mail.yahoo.com

 · 

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: roger77_lb@yahoo.com
  Subject: Re: Locating ( FKs ) References to a Primary Key
  In-Reply-To: <20050817190650.93891.qmail@web51904.mail.yahoo.com>

* 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