Received: from druid.net (druid.net [216.126.72.98]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2ED2Sx07476 for ; Wed, 14 Mar 2001 08:02:28 -0500 (EST) (envelope-from darcy@druid.net) Received: by druid.net (Postfix, from userid 1000) id 1EE491A67; Wed, 14 Mar 2001 08:02:28 -0500 (EST) Subject: Re: copy a record from one table to another (archive) In-Reply-To: <004b01c0abc1$6bd78c60$1001a8c0@archonet.com> "from Richard Huxton at Mar 13, 2001 01:27:57 pm" To: Richard Huxton Date: Wed, 14 Mar 2001 08:02:28 -0500 (EST) Cc: pgsql-sql@postgresql.org, juerg.rietmann@pup.ch Reply-To: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL78 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Message-Id: <20010314130228.1EE491A67@druid.net> From: darcy@druid.net (D'Arcy J.M. Cain) X-Archive-Number: 200103/268 X-Sequence-Number: 1927 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 | 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.