traversing foreign key relationships between tables

Поиск
Список
Период
Сортировка
От Markus Wagner
Тема traversing foreign key relationships between tables
Дата
Msg-id 3B416A35.E5E2AC62@imsd.uni-mainz.de
обсуждение исходный текст
Список pgsql-sql
Hi,

I have the following problem.

There is a trigger event on a table T. Table t is linked through n
intermediate tables (mostly n = 0) to a primary master Table M.

What I need to do is find the entry in M which corresponds to the
triggered entry in T.

I think in pseudocode it would be like this:
S = set of foreign keys in my entry in T
while S is not empty{ get s from S find referenced table t for s if t = M then return s as primary key into M put all
foreignkeys in t into S}
 

My problem is:

How to identify the attributes in a table (in pg_attribute) which are
foreign keys into other tables and how to get the relids of these other
tables?

Thank you very much,

Markus


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

Предыдущее
От: Jie Liang
Дата:
Сообщение: Re: How do I print a message in a function?
Следующее
От: David Stanaway
Дата:
Сообщение: indexing arrays in pgaccess's query interface is failing