Re: Foreign keys

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: MMM <mamuma(at)eresmas(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Foreign keys
Date: 2001-02-19 21:07:32
Message-ID: Pine.BSF.4.21.0102191302560.84309-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


You can reconstruct the information out of the triggers
that are created in pg_trigger. It's not easy to
parse however.

There are three triggers created for each fk constraint,
one on the fk table, two on the pk table. You can
get the tables, columns constrained and match type from
the tgargs. The referential actions are determined
by the function oids of the pk table triggers (do something
like:
select pg_proc.proname from pg_trigger,pg_proc where
pg_trigger.tgfoid=pg_proc.oid;
to get the function names which will look like:
RI_FKey_<action>_(upd|del)
for update or delete, <action> is the action defined.

On Sat, 17 Feb 2001, MMM wrote:

> Sorry for my bad English
>
> I'd like to know how I can see the foreign keys for a table.
>
> Is there a system table where I can do a Select?;
>
> Thank you.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-02-19 21:10:43 Re: not using table aliases in where clause slow-down?
Previous Message Dave Edmondson 2001-02-19 20:24:51 Re: Re: Postgres slowdown on large table joins