Skip site navigation (1) Skip section navigation (2)

Re: Copying data from table to table (cloned tables)

From: "Fourat Zouari" <fourat(at)gmail(dot)com>
To: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
Cc: "Bricklen Anderson" <banderson(at)presinet(dot)com>, pgsql-novice(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org
Subject: Re: Copying data from table to table (cloned tables)
Date: 2006-10-11 11:30:22
Message-ID: 621eda8a0610110430y5be06e22t27d6c99991e86dc8@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-novice
what's the benefits using a serialized trans ?

On 10/10/06, Jim C. Nasby <jim(at)nasby(dot)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(at)nasby(dot)net
> EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)
>

In response to

Responses

pgsql-novice by date

Next:From: Erik FerenczDate: 2006-10-11 12:26:55
Subject: Problem wyth Case-sensitive ORDER BY
Previous:From: Jim C. NasbyDate: 2006-10-10 15:37:25
Subject: Re: Copying data from table to table (cloned tables)

pgsql-admin by date

Next:From: Brandon AikenDate: 2006-10-11 12:56:09
Subject: Re: [ADMIN] Copying data from table to table (cloned tables)
Previous:From: Jim C. NasbyDate: 2006-10-11 01:15:35
Subject: Re: How to remove a superuser

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group