how do I do to get the foreign keys of a table?

From: "Roberto (SmartBit)" <roberto(at)smartbit(dot)inf(dot)br>
To: <pgsql-general(at)postgresql(dot)org>
Subject: how do I do to get the foreign keys of a table?
Date: 2002-10-19 13:14:03
Message-ID: 013a01c27771$66255e50$1501a8c0@NoteBook
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This is my SQL to return the constraints...

select tgconstrname, tr.relname, fr.relname from pg_trigger, pg_class tr,
pg_class fr
where tr.oid = tgrelid and fr.oid = tgconstrrelid and
tr.relname='MyTableName'

so, how do I do to get the foreign keys of a table?

let me be more explicite, I want to get the name of fields from a table that
are related with other table! (foreign key)

NOTE: I want a SQL command to get it from any table of any PostgreSQL
database, so it can not be a function!

please help me

tia

Roberto de Amorim

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Williams, Travis L, NPONS 2002-10-19 15:05:35 Connection timeout..
Previous Message Adrian 'Dagurashibanipal' von Bidder 2002-10-19 11:41:31 Re: French version of the PostgreSQL "Advocacy and