Re: copy record? - Mailing list pgsql-general

From Jasen Betts
Subject Re: copy record?
Date
Msg-id irna9r$dso$3@reversiblemaps.ath.cx
Whole thread Raw
In response to copy record?  ("Gauthier, Dave" <dave.gauthier@intel.com>)
Responses 500KB PDF files for postgresql8.3, which is the most efficient way?
List pgsql-general
On 2011-05-26, Bosco Rama <postgres@boscorama.com> wrote:

>   select * into temp table foo from maintable where primcol=123;
>   update foo set primcol = 456;
>   insert into maintable select * from foo;
>
> You also may need this is if you intend to use the same sequence of
> calls on within the same session:
>
>   drop table foo;

Yet another way to do the same thing:

begin;

create temportary table foo on commit drop as
 select * from maintable where primcol=123;
update foo, set primcol=456;
insert into maintable select * from foo;

commit;

--
⚂⚃ 100% natural

pgsql-general by date:

Previous
From: A B
Date:
Subject: Feature request: Replicate only parts of a database
Next
From: David Fetter
Date:
Subject: Re: unnest with generate_subscripts and same array