From: | "Jim C(dot) Nasby" <jim(at)nasby(dot)net> |
---|---|
To: | Bricklen Anderson <banderson(at)presinet(dot)com> |
Cc: | Fourat Zouari <fourat(at)gmail(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-10 15:37:25 |
Message-ID: | 20061010153724.GI72517@nasby.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-novice |
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)
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Burbello | 2006-10-10 17:37:15 | Build an statement |
Previous Message | Jim C. Nasby | 2006-10-10 15:24:57 | Re: Copying data from table to table (cloned tables) |
From | Date | Subject | |
---|---|---|---|
Next Message | Fourat Zouari | 2006-10-11 11:30:22 | Re: Copying data from table to table (cloned tables) |
Previous Message | Jim C. Nasby | 2006-10-10 15:24:57 | Re: Copying data from table to table (cloned tables) |