Re: Select into - Mailing list pgsql-sql

From Greg Sabino Mullane
Subject Re: Select into
Date
Msg-id 421579d82638a19e77598f40483af716@biglumber.com
Whole thread Raw
In response to Re: Select into  (Gavin 'Beau' Baumanis <gavinb@eclinic.com.au>)
List pgsql-sql
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> Ie. I want to copy the contents of a row (but for the id
> column - of course) into a record in the same table.

BEGIN;
CREATE TEMP TABLE tempfoo AS SELECT * FROM foo WHERE id = 123;
UPDATE tempfoo SET id = 456;
DELETE FROM foo WHERE id = 456;
INSERT INTO foo SELECT * FROM tempfoo;
COMMIT;

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation
PGP Key: 0x14964AC8 200803200737
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkfiTIYACgkQvJuQZxSWSsiCMwCdESkEe8Hc5xHhJ2B3qX3V7EqX
Z2IAoMy65D2OhdUpYVtfEq182PhfsEfZ
=fx5V
-----END PGP SIGNATURE-----




pgsql-sql by date:

Previous
From: Gavin 'Beau' Baumanis
Date:
Subject: Re: Select into
Next
From: "Gurjeet Singh"
Date:
Subject: Re: Select into