Re: How to add constraints without validating data. - Mailing list pgsql-admin

From Nilesh Govindarajan
Subject Re: How to add constraints without validating data.
Date
Msg-id AANLkTinPVDOCGDuqDKFZHRYArK4s6s5Iy6XQfPLKe2aS@mail.gmail.com
Whole thread Raw
In response to Re: How to add constraints without validating data.  (Iñigo Martinez Lasala <imartinez@vectorsf.com>)
Responses Re: How to add constraints without validating data.
List pgsql-admin
On Thu, May 27, 2010 at 9:49 PM, Iñigo Martinez Lasala
<imartinez@vectorsf.com> wrote:
> Constraints are special triggers, but triggers anyway.
>
> So, If you truncate the table, create the contraint and then restore with
> triggers disabled, it could be faster that create the contraint and wait
> until it checks all table data... or not... :)
>
>
>
> -----Original Message-----
> From: Nilesh Govindarajan <lists@itech7.com>
> To: Iñigo Martinez Lasala <imartinez@vectorsf.com>
> Cc: Amit jain <amitjain@synechron.com>, pgsql-admin@postgresql.org
> Subject: Re: [ADMIN] How to add constraints without validating data.
> Date: Thu, 27 May 2010 21:45:25 +0530
>
> How would disabling triggers help that ? He just wants to add
> constraints without loss of data. I don't think he has any triggers.
>
>
>


I agree constraints are triggers. But as far as I know, truncating
table doesn't disable the constraints.
Its same as deleteing all rows and then altering the table.
In that manner, even my solution would be appropriate because it
creates a duplicate table with the constraints.
Whatever be the method, I don't think its possible to avoid the
constraints. Correct me if I'm wrong.

--
Nilesh Govindarajan
Facebook: nilesh.gr
Twitter: nileshgr
Website: www.itech7.com

pgsql-admin by date:

Previous
From: alvherre
Date:
Subject: Re: command tag logging
Next
From: Tom Lane
Date:
Subject: Re: command tag logging