Re: How can I delete a primary or foreign key? - Mailing list pgsql-general

From scott.marlowe
Subject Re: How can I delete a primary or foreign key?
Date
Msg-id Pine.LNX.4.33.0402200854300.10378-100000@css120.ihs.com
Whole thread Raw
In response to How can I delete a primary or foreign key?  (Tibor <tiborh@mail.datanet.hu>)
Responses Re: How can I delete a primary or foreign key?  (tibor@opendiary.com)
List pgsql-general
On Fri, 20 Feb 2004, Tibor wrote:

> I am using PostgreSQL 7.4.1 (only through psql)
> I know, that the command
>
> ALTER TABLE OFFICES
>     DROP PRIMARY KEY (CITY);
>
> and its foreign key equivalent:
>
> ALTER TABLE SALESREPS
>     DROP CONSTRAINT
> FOREIGN KEY (REP_OFFICE)
>     REFERENCES OFFICES;
>
> don't work in PostgreSQL because they are not implemented. However, isn't
> there another way of removing them?
> I also tried to drop the index associated with the primary key, but it is not
> permitted.
>
> Anyone with any idea?

It's an alter table:

alter table offices drop constraint constraint_name

where constraint name is usually tablename_pkey

assuming it was created the normal way, on a 7.4 box.


pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: How can I delete a primary or foreign key?
Next
From: tibor
Date:
Subject: Re: How can I delete a primary or foreign key?