Search Postgresql Archives

Re: copy record?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2011-05-26, Bosco Rama <postgres@xxxxxxxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux