Re: How can I delete a primary or foreign key?

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Tibor <tiborh(at)mail(dot)datanet(dot)hu>
Cc: PostreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: How can I delete a primary or foreign key?
Date: 2004-02-20 15:42:55
Message-ID: 20040220074130.A82937@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

That's not the correct syntax for ALTER TABLE ... DROP CONSTRAINT.

ALTER TABLE tablename DROP CONSTRAINT constraint_name [RESTRICT | CASCADE]

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2004-02-20 15:56:06 Re: How can I delete a primary or foreign key?
Previous Message Gellert, Andre 2004-02-20 15:32:55 PHP + Postgres: More than 1000 postmasters produce 70.000 context switches