On Wed, Jan 12, 2005 at 10:56:00AM -0800, sarlav kumar wrote:
> Is there an easy way to find out the list of tables that have a
> FK relation on a particular table?
You could query the system catalogs, either directly or via the
Information Schema (the latter is available in 7.4 and later).
See the "System Catalogs" and "The Information Schema" chapters
in the documentation.
> Say, if I have a 'customer' table, I would like to get the tables
> that depend on customer and not the tables on which customer depends.
I think this'll work, although I did only trivial testing with it:
SELECT conrelid::regclass, conname
FROM pg_constraint
WHERE confrelid = 'customer'::regclass AND contype = 'f';
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/