Re: [ADMIN] Copying data from table to table (cloned tables)

From: "Brandon Aiken" <BAiken(at)winemantech(dot)com>
To: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: [ADMIN] Copying data from table to table (cloned tables)
Date: 2006-10-11 12:56:09
Message-ID: F8E84F0F56445B4CB39E019EF67DACBA3411DB@exchsrvr.winemantech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-novice

It makes it so that a transaction is highly isolated.

http://www.postgresql.org/docs/8.1/interactive/transaction-iso.html

--

Brandon Aiken

CS/IT Systems Engineer

________________________________

From: pgsql-novice-owner(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org] On Behalf Of Fourat Zouari
Sent: Wednesday, October 11, 2006 7:30 AM
To: Jim C. Nasby
Cc: Bricklen Anderson; pgsql-novice(at)postgresql(dot)org;
pgsql-admin(at)postgresql(dot)org
Subject: Re: [NOVICE] [ADMIN] Copying data from table to table (cloned
tables)

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

Browse pgsql-admin by date

  From Date Subject
Next Message Richard Ray 2006-10-11 13:02:07 Re: How to remove a superuser
Previous Message Fourat Zouari 2006-10-11 11:30:22 Re: Copying data from table to table (cloned tables)

Browse pgsql-novice by date

  From Date Subject
Next Message Bruno Wolff III 2006-10-11 15:14:39 Re: Copying data from table to table (cloned tables)
Previous Message Erik Ferencz 2006-10-11 12:26:55 Problem wyth Case-sensitive ORDER BY