pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Zhang, Anna <azhang@verisign.com>
Cc: 'pgsql-admin@postgresql.org' <pgsql-admin@postgresql.org>
Subject: Re: fk constraint can't be dropped
Date: Wed, 6 Mar 2002 14:41:05 -0800 (PST)
Message-ID: <20020306143636.K13015-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <5511D658682A7740BA295CCF1E1233A635A866@vsvapostal2.bkup3>

On Wed, 6 Mar 2002, Zhang, Anna wrote:

> Hi,
> I created a foreign key constraint on table referral like this:
>
> alter table referral add constraint fk_referral foreign key (handle)
> references domain (handle);
> create
>
> alter table referral drop constraint fk_referral restrict;
> ERROR: ALTER TABLE / DROP CONSTRAINT: fk_referral does not exist.
>
> I am using postgres 7.2. If fk can't be dropped, what the synax: ALTER TABLE
> [ ONLY ] table DROP CONSTRAINT constraint { RESTRICT | CASCADE } for in
> docs? If we have to drop fk, does this mean we have to drop table and

The man page for alter table seems fairly explicit that drop constraint
only drops check constraints currently.

> recreate without fk? Stupid!

That's the easiest way.  You could also drop the three triggers that
actually are the implementation of the constraint (which you can find
by looking into pg_trigger - look for triggers that have names like
RI_ConstraintTrigger_<numbers> that have appropriate the appropriate
name in tgconstrname and use drop trigger
"RI_ConstraintTrigger_<numbers>"; for each of them)





view thread (2+ messages)

Message-ID: <20020306143636.K13015-100000@megazone23.bigpanda.com>
Permalink:  ../20020306143636.K13015-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20020306143636.K13015-100000@megazone23.bigpanda.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-admin@postgresql.org
  Cc: sszabo@megazone23.bigpanda.com, azhang@verisign.com
  Subject: Re: fk constraint can't be dropped
  In-Reply-To: <20020306143636.K13015-100000@megazone23.bigpanda.com>
  References: <5511D658682A7740BA295CCF1E1233A635A866@vsvapostal2.bkup3> <20020306143636.K13015-100000@megazone23.bigpanda.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