Gauthier, Dave wrote:
> Well, I found a better way, but still open to suggestions.
> 
> This is what I have so far...
> 
> create temporary table foo as select * from maintable where 1-0;  -- Credit 4 
> this goes to a post in the PG archives
> insert into foo (select * from maintable where primcol=123);
> update foo, set primcol=456;
> insert into maintable (select * from foo);

This alleviates the need to trick the back-end using 'where 1-0'
and also does the insert, all in one go.

  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;

HTH

Bosco.

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

Reply via email to