Re: find foreign key name - Mailing list pgsql-jdbc

From Tore Halset
Subject Re: find foreign key name
Date
Msg-id FAB1A373-17E8-4686-8CF5-682D014089EB@pvv.ntnu.no
Whole thread Raw
In response to Re: find foreign key name  (Heikki Linnakangas <heikki@enterprisedb.com>)
Responses Re: find foreign key name  (Kris Jurka <books@ejurka.com>)
Re: find foreign key name  (danap@ttc-cmc.net)
List pgsql-jdbc
On Dec 18, 2007, at 10:36 , Heikki Linnakangas wrote:

> Tore Halset wrote:
>> I want to programatically drop a foreign key constraint via jdbc.
>> How can I find the foreign key name for a PostgreSQL foreign key
>> via jdbc? I know all about the related tables and columns, but not
>> the name of the constraint.
>
> You can query the pg_constraint catalog table:
>
> http://www.postgresql.org/docs/8.2/interactive/catalog-pg-constraint.html
>
> There seems to be some example queries in the user comments that you
> might be interested.

Thanks. I was hoping for something easy in
DatabaseMetaData#getExportedKeys.. :) But looking at pg_constraint
should work fine.

Regards,
  - Tore.


pgsql-jdbc by date:

Previous
From: tivvpgsqljdbc@gtech-ua.com
Date:
Subject: Re: concat returns null
Next
From: Kris Jurka
Date:
Subject: Re: find foreign key name