traversing foreign key relationships between tables - Mailing list pgsql-sql

From Markus Wagner
Subject traversing foreign key relationships between tables
Date
Msg-id 3B416A35.E5E2AC62@imsd.uni-mainz.de
Whole thread Raw
List 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 by date:

Previous
From: Jie Liang
Date:
Subject: Re: How do I print a message in a function?
Next
From: David Stanaway
Date:
Subject: indexing arrays in pgaccess's query interface is failing