On Mon, Jan 24, 2005 at 08:35:45PM -0800, Benjamin Smith wrote: > Is there a way in PG 7.3, given a field, to find out what other tables & > records are linked to it via a foreign key? See the "System Catalogs" chapter in the documentation: http://www.postgresql.org/docs/7.3/static/catalogs.html The pg_constraint table contains, among other things, foreign key constraints. By querying it and joining it with pg_attribute, pg_class, and pg_namespace, you could get a list of tables and columns that have foreign key constraints on the given table and column; from that you could build queries to find out which rows in those tables match the given value. You could wrap all this code in a set-returning function. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend