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

From Heikki Linnakangas
Subject Re: find foreign key name
Date
Msg-id 476794A6.8020707@enterprisedb.com
Whole thread Raw
In response to find foreign key name  (Tore Halset <halset@pvv.ntnu.no>)
Responses Re: find foreign key name  (Tore Halset <halset@pvv.ntnu.no>)
List pgsql-jdbc
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.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

pgsql-jdbc by date:

Previous
From: Tore Halset
Date:
Subject: find foreign key name
Next
From: Christian Schröder
Date:
Subject: Missing fields in getColumns() result