pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brandon Aiken <BAiken@winemantech.com>
To: Jim C. Nasby <jim@nasby.net>
Cc: pgsql-novice@postgresql.org
Subject: Re: [ADMIN] Copying data from table to table (cloned tables)
Date: Wed, 11 Oct 2006 08:56:09 -0400
Message-ID: <F8E84F0F56445B4CB39E019EF67DACBA3411DB@exchsrvr.winemantech.com> (raw)
In-Reply-To: <621eda8a0610110430y5be06e22t27d6c99991e86dc8@mail.gmail.com>

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@postgresql.org
[mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Fourat Zouari
Sent: Wednesday, October 11, 2006 7:30 AM
To: Jim C. Nasby
Cc: Bricklen Anderson; pgsql-novice@postgresql.org;
pgsql-admin@postgresql.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@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)

 

view thread (13+ messages)  latest in thread

Message-ID: <F8E84F0F56445B4CB39E019EF67DACBA3411DB@exchsrvr.winemantech.com>
Permalink:  ../F8E84F0F56445B4CB39E019EF67DACBA3411DB@exchsrvr.winemantech.com/
Also on:    postgresql.org/message-id/F8E84F0F56445B4CB39E019EF67DACBA3411DB@exchsrvr.winemantech.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: BAiken@winemantech.com, jim@nasby.net, pgsql-novice@postgresql.org
  Subject: Re: [ADMIN] Copying data from table to table (cloned tables)
  In-Reply-To: <F8E84F0F56445B4CB39E019EF67DACBA3411DB@exchsrvr.winemantech.com>
  References: <621eda8a0610110430y5be06e22t27d6c99991e86dc8@mail.gmail.com> <F8E84F0F56445B4CB39E019EF67DACBA3411DB@exchsrvr.winemantech.com>

* 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