Re: copy a record from one table to another (archive)

Поиск
Список
Период
Сортировка
От darcy@druid.net (D'Arcy J.M. Cain)
Тема Re: copy a record from one table to another (archive)
Дата
Msg-id 20010314130228.1EE491A67@druid.net
обсуждение исходный текст
Ответ на Re: copy a record from one table to another (archive)  ("Richard Huxton" <dev@archonet.com>)
Список 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 по дате отправления:

Предыдущее
От: "Richard Huxton"
Дата:
Сообщение: Re: my pgsql error?
Следующее
От: "pgsql-sql"
Дата:
Сообщение: