From arun@gananathan.fslife.co.uk Mon Jan 19 18:39:31 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id AAC67D1B513 for ; Mon, 19 Jan 2004 18:39:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 09092-07 for ; Mon, 19 Jan 2004 14:39:00 -0400 (AST) Received: from cmailm6.svr.pol.co.uk (cmailm6.svr.pol.co.uk [195.92.193.22]) by svr1.postgresql.org (Postfix) with ESMTP id 87EA9D1CA65 for ; Mon, 19 Jan 2004 14:38:58 -0400 (AST) Received: from user-4227.l1.c3.dsl.pol.co.uk ([81.79.16.131] helo=arun) by cmailm6.svr.pol.co.uk with smtp (Exim 4.14) id 1AieI2-0001wk-4n for pgsql-admin@postgresql.org; Mon, 19 Jan 2004 18:38:22 +0000 Message-ID: <000801c3debb$b24c47a0$83104f51@arun> From: "Arun Gananathan" To: Subject: Re: popstgresql query Date: Mon, 19 Jan 2004 18:40:21 -0000 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0005_01C3DEBB.B1AD96A0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=HTML_40_50 X-Spam-Level: X-Archive-Number: 200401/216 X-Sequence-Number: 12079 This is a multi-part message in MIME format. ------=_NextPart_000_0005_01C3DEBB.B1AD96A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, Could anyone please let me know how to perform the following in postgresql I have two tables called P , Q with the same attributes and data tpyes. I = want to insert a record ( for example called A) into table P, when deleting= the same record( for example called A which is already in the other table= ) from the other table Q. Thank you arun ------=_NextPart_000_0005_01C3DEBB.B1AD96A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
Could anyone please let me know how to per= form the=20 following in postgresql
I have two tables called P , Q  with = the same=20 attributes and data tpyes. I want to insert a record ( for example cal= led=20 A) into table P, when deleting the same record( for example&= nbsp;=20 called A which is already in the other table)  from the other tab= le=20 Q.
Thank you
 
arun
------=_NextPart_000_0005_01C3DEBB.B1AD96A0-- From scott.marlowe@ihs.com Mon Jan 26 17:44:09 2004 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 72661D1D23E for ; Mon, 26 Jan 2004 17:44:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 58211-04 for ; Mon, 26 Jan 2004 13:43:39 -0400 (AST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id F41B2D1CC98 for ; Mon, 26 Jan 2004 13:43:37 -0400 (AST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i0QHghfN018371; Mon, 26 Jan 2004 10:42:43 -0700 (MST) Date: Mon, 26 Jan 2004 10:39:46 -0700 (MST) From: "scott.marlowe" To: Arun Gananathan Cc: Subject: Re: popstgresql query In-Reply-To: <000801c3debb$b24c47a0$83104f51@arun> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/239 X-Sequence-Number: 12102 On Mon, 19 Jan 2004, Arun Gananathan wrote: > Hi, > Could anyone please let me know how to perform the following in > postgresql > I have two tables called P , Q with the same attributes and data > tpyes. I want to insert a record ( for example called A) into table P, > when deleting the same record( for example called A which is already in > the other table) from the other table Q. Pretty straight ahead. You can either use a fancy trigger setup, or just do it in a transaction to ensure integrity: begin; insert into P (select * from Q where recid='A'; delete from Q where recid='A'; commit; If the insert fails, the delete won't happen either. That close to what you want?