Re: find foreign key name

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Tore Halset <halset(at)pvv(dot)ntnu(dot)no>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: find foreign key name
Date: 2007-12-18 09:36:38
Message-ID: 476794A6.8020707@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Christian Schröder 2007-12-18 10:47:11 Missing fields in getColumns() result
Previous Message Tore Halset 2007-12-18 09:20:12 find foreign key name