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

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: How can I delete a primary or foreign key?
Дата
Msg-id 20040220085639.K84463@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Re: How can I delete a primary or foreign key?  (tibor <tiborh@mail.datanet.hu>)
Ответы Re: How can I delete a primary or foreign key?  (tibor <tiborh@mail.datanet.hu>)
Список pgsql-general
On Fri, 20 Feb 2004, tibor wrote:

> I forgot to mention that I have tried numerous variations.
> The one quoted in the original mail was from "The Complete Reference" series.
> I've also tried the one that the \h command suggests:
>
> ALTER TABLE PARENTS DROP CONSTRAINT FOREIGN KEY (TYPE) CASCADE;

\h shows me
ALTER TABLE [ ONLY ] name [ * ]
    DROP CONSTRAINT constraint_name [ RESTRICT | CASCADE ]

constraint_name isn't something like: FOREIGN KEY ...
it's the name given to the constraint (preferably at add time with the
CONSTRAINT constraint_name clause otherwise it's given an arbitrary name).

If you use \d tablename
You should see something like:
Foreign-key constraints:
    "$1" FOREIGN KEY (b) REFERENCES a(a)

And the drop would look like
ALTER TABLE tablename DROP CONSTRAINT "$1";


В списке pgsql-general по дате отправления:

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: How can I delete a primary or foreign key?
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: PHP + Postgres: More than 1000 postmasters produce 70.000 context switches