From: | Roger Motorola <roger77_lb(at)yahoo(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Locating ( FKs ) References to a Primary Key |
Date: | 2005-08-17 19:06:50 |
Message-ID: | 20050817190650.93891.qmail@web51904.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Mischa Sandberg | 2005-08-17 19:31:16 | Re: Is it This Join Condition Do-Able? |
Previous Message | Jeremy Semeiks | 2005-08-17 17:44:50 | Re: Is it This Join Condition Do-Able? |