Re: copy record?

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: copy record?
Date: 2011-05-27 04:45:47
Message-ID: irna9r$dso$3@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

On 2011-05-26, Bosco Rama <postgres(at)boscorama(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A B 2011-05-27 04:53:17 Feature request: Replicate only parts of a database
Previous Message Tian Luo 2011-05-27 04:24:16 Re: "full_page_writes" makes no difference?

Browse pgsql-sql by date

  From Date Subject
Next Message Merlin Moncure 2011-05-27 15:39:22 Re: copy record?
Previous Message Bosco Rama 2011-05-26 21:18:41 Re: copy record?