Re: 7.4 - TODO : alter table drop foreign key - Mailing list pgsql-hackers

From Dan Langille
Subject Re: 7.4 - TODO : alter table drop foreign key
Date
Msg-id 3DEF4379.18392.69F1887@localhost
Whole thread Raw
In response to Re: 7.4 - TODO : alter table drop foreign key  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Responses Re: 7.4 - TODO : alter table drop foreign key
List pgsql-hackers
On 5 Dec 2002 at 9:02, Stephan Szabo wrote:

> On Thu, 5 Dec 2002, Dan Langille wrote:
> 
> > Found the solution:
> >
> > drop trigger "RI_ConstraintTrigger_4278488" on watch_list_staging;
> 
> Actually there are three triggers for the constraint.  You may have
> dangling triggers on the other table of the constraint.  It's one on the
> table the constraint's defined on and two on the referenced table.
> 
> > Given that the FK in question did not have a name to start with, I
> > concede that it would be difficult to code DROP FOREIGN KEY.
> >
> > What about supporting ALTER TABLE <table> ADD FOREIGN KEY <keyname>
> > ... which at present we don't?  That would then make dropping the FK
> > a simple coding issue?
> 
> ISTM, that's
>  ALTER TABLE <table> ADD CONSTRAINT <name> FOREIGN KEY ...
> which should be there in any 7.x.

Agreed.  But the syntax is different. If we are supporting "ALTER 
TABLE <table> ADD FOREIGN KEY " without a name, why not support it 
with a name?

> And the drop constraint for foreign keys (and the \d display stuff) is new
> in 7.3.

That's going to be much more useful.  I installed 7.3 for testing 
this morning.  Looking at it now, I no longer see a need for a DROP 
FOREIGN KEY. 

Thank you.
-- 
Dan Langille : http://www.langille.org/



pgsql-hackers by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: 7.4 - TODO : alter table drop foreign key
Next
From: Stephan Szabo
Date:
Subject: Re: 7.4 - TODO : alter table drop foreign key