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 ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])