Re: Adding Foreign Key Constraint To Existing Table - Mailing list pgsql-general

From Rich Shepard
Subject Re: Adding Foreign Key Constraint To Existing Table
Date
Msg-id alpine.LNX.2.00.1107011502460.31349@salmo.appl-ecosys.com
Whole thread Raw
In response to Re: Adding Foreign Key Constraint To Existing Table  (Thom Brown <thom@linux.com>)
List pgsql-general
On Fri, 1 Jul 2011, Thom Brown wrote:

> By the way, rather than dropping the foreign key then recreating it, you
> could always do this:
>
> ALTER TABLE tablename DISABLE TRIGGER ALL;
>
> Then it would ignore the foreign key trigger and you could put in
> mischievous values... but remember to enable it again (replace DISABLE
> with ENABLE).  You'll have to be a superuser to do it though.

Thom,

   Valuable information, thanks. I try to get the table structure correct
before loading it into a database. In this case I was copying structure
(with minor mods) from an existing environmental database and it took me a
while to notice the original authors used synthetic keys when they are not
needed. So, I got rid of those keys.

Rich

pgsql-general by date:

Previous
From: Thom Brown
Date:
Subject: Re: Adding Foreign Key Constraint To Existing Table
Next
From: David Johnston
Date:
Subject: Re: Adding Foreign Key Constraint To Existing Table