pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki@enterprisedb.com>
To: Tore Halset <halset@pvv.ntnu.no>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: find foreign key name
Date: Tue, 18 Dec 2007 09:36:38 +0000
Message-ID: <476794A6.8020707@enterprisedb.com> (raw)
In-Reply-To: <FA2C2FFC-8826-46E9-ACE4-9BBF88EBB381@pvv.ntnu.no>
References: <FA2C2FFC-8826-46E9-ACE4-9BBF88EBB381@pvv.ntnu.no>

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



view thread (6+ messages)  latest in thread

Message-ID: <476794A6.8020707@enterprisedb.com>
Permalink:  ../476794A6.8020707@enterprisedb.com/
Also on:    postgresql.org/message-id/476794A6.8020707@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: heikki@enterprisedb.com, halset@pvv.ntnu.no
  Subject: Re: find foreign key name
  In-Reply-To: <476794A6.8020707@enterprisedb.com>
  References: <FA2C2FFC-8826-46E9-ACE4-9BBF88EBB381@pvv.ntnu.no> <476794A6.8020707@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox