Can you help me with this query? - Mailing list pgsql-general

From mike.griffin@mygenerationsoftware.com
Subject Can you help me with this query?
Date
Msg-id 4238.4.160.192.46.1087264113.squirrel@4.160.192.46
Whole thread Raw
Responses Re: Can you help me with this query?  (Joe Conway <mail@joeconway.com>)
List pgsql-general
The query below will return all of the foreign keys in the current schema,
I get the ForeignKey name as FK_NAME and both the primary and foreign
table's name and schema, now I just need the columns involved in the
foreign key itself, there is a column called confkey in pg_constraint and
it's an array?  It holds the column id


SELECT ct.oid, conname as FK_NAME, confkey, nl.nspname as PK_TABLE_SCHEMA,
cl.relname as PK_TABLE_NAME,
nr.nspname as FK_TABLE_SCHEMA, cr.relname as FK_TABLE_NAME, description
FROM pg_constraint ct
JOIN pg_class cl ON cl.oid=conrelid
JOIN pg_namespace nl ON nl.oid=cl.relnamespace
JOIN pg_class cr ON cr.oid=confrelid
JOIN pg_namespace nr ON nr.oid=cr.relnamespace
LEFT OUTER JOIN pg_description des ON des.objoid=ct.oid
WHERE contype='f'



pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: perl access
Next
From: Tom Allison
Date:
Subject: Re: perl access