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

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: "Roberto (SmartBit)" <roberto(at)smartbit(dot)inf(dot)br>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: how do I do to get the foreign keys of a table?
Date: 2002-10-19 16:27:34
Message-ID: 20021019092631.Q43125-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 19 Oct 2002, Roberto (SmartBit) wrote:

> 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)

You'll have to parse it out from tgargs.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-10-19 16:38:04 Re: Connection timeout..
Previous Message Williams, Travis L, NPONS 2002-10-19 15:05:35 Connection timeout..