Re: copy a record from one table to another (archive) - Mailing list pgsql-sql

From darcy@druid.net (D'Arcy J.M. Cain)
Subject Re: copy a record from one table to another (archive)
Date
Msg-id 20010314130228.1EE491A67@druid.net
Whole thread Raw
In response to Re: copy a record from one table to another (archive)  ("Richard Huxton" <dev@archonet.com>)
List pgsql-sql
Thus spake Richard Huxton
> begin;
>   insert into archive_foo (select * from foo where foo_id=1);
>   delete from foo where foo_id=1;
> commit;
> 
> Is probably the closest you could get.
> 
> Alternatively, you could wrap the above up in a function and just go:
> 
> select do_archive_foo(1);

Or even use a trigger if suitable.  You can have the delete automatically
trigger an insert into another table.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


pgsql-sql by date:

Previous
From: "Richard Huxton"
Date:
Subject: Re: my pgsql error?
Next
From: "pgsql-sql"
Date:
Subject: