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

From: "Richard Huxton" <dev(at)archonet(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>, <juerg(dot)rietmann(at)pup(dot)ch>
Subject: Re: copy a record from one table to another (archive)
Date: 2001-03-13 13:27:57
Message-ID: 004b01c0abc1$6bd78c60$1001a8c0@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


----- Original Message -----
From: <juerg(dot)rietmann(at)pup(dot)ch>
To: <pgsql-sql(at)postgresql(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-03-13 15:04:12 Re: != and <> operators
Previous Message Christof Glaser 2001-03-13 13:19:21 Re: my pgsql error?