From: Robert Voinea <robert.voinea@topex.ro>
To: pgsql-admin@postgresql.org
Cc: Nilesh Govindarajan <lists@itech7.com>
Cc: Iñigo Martinez Lasala <imartinez@vectorsf.com>
Cc: Amit jain <amitjain@synechron.com>
Subject: Re: How to add constraints without validating data.
Date: Fri, 28 May 2010 08:44:52 +0300
Message-ID: <201005280844.53208.robert.voinea@topex.ro> (raw)
In-Reply-To: <AANLkTinPVDOCGDuqDKFZHRYArK4s6s5Iy6XQfPLKe2aS@mail.gmail.com>
References: <4BFE64D4.4020107@synechron.com>
<1274977189.19383.51.camel@deimos>
<AANLkTinPVDOCGDuqDKFZHRYArK4s6s5Iy6XQfPLKe2aS@mail.gmail.com>
Why don't you use a partition?
Create another table that inherits from the table and add your new constraints
to the new table.
On Thursday 27 May 2010 19:32:33 Nilesh Govindarajan wrote:
> 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... :)
> >
> > 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.
--
Robert Voinea <robert (dot) voinea (at) topex (dot) ro>
Software Developer
Phone: +40 21 408 38 00 / ext. 343
Fax: +40 21 408 38 08
Local time: GMT+2
http://www.topex.ro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: robert.voinea@topex.ro, lists@itech7.com, imartinez@vectorsf.com, amitjain@synechron.com
Subject: Re: How to add constraints without validating data.
In-Reply-To: <201005280844.53208.robert.voinea@topex.ro>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox