pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: pgsql-sql@postgresql.org
To: juerg.rietmann@pup.ch
Subject: Re: copy a record from one table to another (archive)
Date: Tue, 13 Mar 2001 13:27:57 -0000
Message-ID: <004b01c0abc1$6bd78c60$1001a8c0@archonet.com> (raw)
References: <OF5A361BCE.81DBD27E-ONC1256A0E.0045F482@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




view thread (3+ messages)  latest in thread

Message-ID: <004b01c0abc1$6bd78c60$1001a8c0@archonet.com>
Permalink:  ../004b01c0abc1$6bd78c60$1001a8c0@archonet.com/
Also on:    postgresql.org/message-id/004b01c0abc1$6bd78c60$1001a8c0@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, juerg.rietmann@pup.ch
  Subject: Re: copy a record from one table to another (archive)
  In-Reply-To: <004b01c0abc1$6bd78c60$1001a8c0@archonet.com>
  References: <OF5A361BCE.81DBD27E-ONC1256A0E.0045F482@pup.ch> <004b01c0abc1$6bd78c60$1001a8c0@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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