Locating ( FKs ) References to a Primary Key

Поиск
Список
Период
Сортировка
От Roger Motorola
Тема Locating ( FKs ) References to a Primary Key
Дата
Msg-id 20050817190650.93891.qmail@web51904.mail.yahoo.com
обсуждение исходный текст
Список 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 


В списке pgsql-sql по дате отправления:

Предыдущее
От: Jeremy Semeiks
Дата:
Сообщение: Re: Is it This Join Condition Do-Able?
Следующее
От: "Dmitri Bichko"
Дата:
Сообщение: Re: Is it This Join Condition Do-Able?