From: | Markus Wagner <wagner(at)imsd(dot)uni-mainz(dot)de> |
---|---|
To: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | traversing foreign key relationships between tables |
Date: | 2001-07-03 06:46:13 |
Message-ID: | 3B416A35.E5E2AC62@imsd.uni-mainz.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 foreign keys 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
From | Date | Subject | |
---|---|---|---|
Next Message | David Stanaway | 2001-07-03 09:05:05 | indexing arrays in pgaccess's query interface is failing |
Previous Message | Jie Liang | 2001-07-03 00:59:17 | Re: How do I print a message in a function? |