Re: Fw: Removing foreign key and adding sequence

From: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
To: Chad Thompson <chad(at)weblinkservices(dot)com>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Fw: Removing foreign key and adding sequence
Date: 2003-06-26 18:17:39
Message-ID: 1056651459.1195.33.camel@billy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Am Don, 2003-06-26 um 19.28 schrieb Chad Thompson:

> 7.32. Can I just drop the foreign key? That would be SO much easier :-)

Since 7.3 it's very easy, but even with 7.2 you could:

7.3:
\d table_name
if the key is labeled with e.g. $1:
ALTER TABLE table_name DROP CONSTRAINT "$1";

7.2:
DROP TRIGGER "RI_ConstraintTrigger_123456" on table_name;

You have to do this 3 times, because a FK in < 7.3 where just 3
constraint triggers.

you can get the trigger names with
\d table_name
or
pg_dump db_name and searching the correct CONSTRAINT TRIGGER

HTH
--
e-Trolley Sayegh & John, Nabil Sayegh
Tel.: 0700 etrolley /// 0700 38765539
Fax.: +49 69 8299381-8
PGP : http://www.e-trolley.de

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message phil campaigne 2003-06-26 19:40:21 Best Practice??
Previous Message Chad Thompson 2003-06-26 17:28:37 Fw: Removing foreign key and adding sequence