Re: [ADMIN] Copying data from table to table (cloned tables) - Mailing list pgsql-novice

From Fourat Zouari
Subject Re: [ADMIN] Copying data from table to table (cloned tables)
Date
Msg-id 621eda8a0610110430y5be06e22t27d6c99991e86dc8@mail.gmail.com
Whole thread Raw
In response to Re: [ADMIN] Copying data from table to table (cloned tables)  ("Jim C. Nasby" <jim@nasby.net>)
Responses Re: [ADMIN] Copying data from table to table (cloned tables)  ("Brandon Aiken" <BAiken@winemantech.com>)
Re: [ADMIN] Copying data from table to table (cloned tables)  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-novice
what's the benefits using a serialized trans ?

On 10/10/06, Jim C. Nasby <jim@nasby.net> wrote:
On Tue, Oct 10, 2006 at 10:24:57AM -0500, Jim C. Nasby wrote:
> > If you just want to copy the data across to the other table:
> > begin;
> > insert into table2 select * from table1 where <some criteria>;
> > commit;
> >
> > if you also want to remove that same data from table1:
> > begin;
> > insert into table2 select * from table1 where <some criteria>;
> > delete from table1 where <same criteria as above>;
> > commit;

I forgot to mention you could also use a serializable transaction with
your method...

BEGIN ISOLATION LEVEL SERIALIZABLE;
INSERT ...
DELETE ...
COMMIT;

Just remember you'll need to deal with the possibility of a 'could not
serialize' error.
--
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com       512.569.9461 (cell)

pgsql-novice by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: [ADMIN] Copying data from table to table (cloned tables)
Next
From: "Brandon Aiken"
Date:
Subject: Re: [ADMIN] Copying data from table to table (cloned tables)