pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedcopy a record from one table to another (archive)
3+ messages / 3 participants
[nested] [flat]
* copy a record from one table to another (archive)
@ 2001-03-13 12:45 juerg.rietmann@pup.ch
2001-03-13 13:27 ` Re: copy a record from one table to another (archive) Richard Huxton <dev@archonet.com>
0 siblings, 1 reply; 3+ messages in thread
From: juerg.rietmann@pup.ch @ 2001-03-13 12:45 UTC (permalink / raw)
To: pgsql-sql
Hello there
Is it possible to move a record from one table to another to do a archive
with a simple command like move .... ?
Thanks .... jr
============================================
PFISTER + PARTNER, SYSTEM - ENGINEERING AG
Juerg Rietmann
Grundstrasse 22a
6343 Rotkreuz
Switzerland
phone: +4141 790 4040
fax: +4141 790 2545
mobile: +4179 211 0315
============================================
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: copy a record from one table to another (archive)
2001-03-13 12:45 copy a record from one table to another (archive) juerg.rietmann@pup.ch
@ 2001-03-13 13:27 ` Richard Huxton <dev@archonet.com>
2001-03-14 13:02 ` Re: copy a record from one table to another (archive) D'Arcy J.M. Cain <darcy@druid.net>
0 siblings, 1 reply; 3+ messages in thread
From: Richard Huxton @ 2001-03-13 13:27 UTC (permalink / raw)
To: pgsql-sql; juerg.rietmann@pup.ch
----- Original Message -----
From: <juerg.rietmann@pup.ch>
To: <pgsql-sql@postgresql.org>
Sent: Tuesday, March 13, 2001 12:45 PM
Subject: [SQL] copy a record from one table to another (archive)
> Hello there
>
> Is it possible to move a record from one table to another to do a archive
> with a simple command like move .... ?
>
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);
- Richard Huxton
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: copy a record from one table to another (archive)
2001-03-13 12:45 copy a record from one table to another (archive) juerg.rietmann@pup.ch
2001-03-13 13:27 ` Re: copy a record from one table to another (archive) Richard Huxton <dev@archonet.com>
@ 2001-03-14 13:02 ` D'Arcy J.M. Cain <darcy@druid.net>
0 siblings, 0 replies; 3+ messages in thread
From: darcy@druid.net @ 2001-03-14 13:02 UTC (permalink / raw)
To: Richard Huxton <dev@archonet.com>; +Cc: pgsql-sql; juerg.rietmann@pup.ch
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-03-14 13:02 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-03-13 12:45 copy a record from one table to another (archive) juerg.rietmann@pup.ch
2001-03-13 13:27 ` Richard Huxton <dev@archonet.com>
2001-03-14 13:02 ` D'Arcy J.M. Cain <darcy@druid.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox