X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A8861DADAF for ; Tue, 25 Oct 2005 00:09:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63881-10 for ; Tue, 25 Oct 2005 03:09:45 +0000 (GMT) Received: from b.mail.sonic.net (b.mail.sonic.net [64.142.19.5]) by svr1.postgresql.org (Postfix) with ESMTP id A8C8ADADC5 for ; Tue, 25 Oct 2005 00:09:45 -0300 (ADT) Received: from localhost.localdomain (64-142-36-103.dsl.static.sonic.net [64.142.36.103]) by b.mail.sonic.net (8.13.3/8.13.3) with ESMTP id j9P39iYl021944 (version=TLSv1/SSLv3 cipher=DES-CBC3-SHA bits=168 verify=NO); Mon, 24 Oct 2005 20:09:44 -0700 Received: from elein by localhost.localdomain with local (Exim 4.50) id 1EUFAz-0004tl-3T; Mon, 24 Oct 2005 20:08:37 -0700 Date: Mon, 24 Oct 2005 20:08:37 -0700 To: efa din Cc: pgsql-sql@postgresql.org Subject: Re: how to create rule as on delete Message-ID: <20051025030836.GW30170@varlena.com> Mail-Followup-To: efa din , pgsql-sql@postgresql.org References: <20051019044334.51090.qmail@web33302.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051019044334.51090.qmail@web33302.mail.mud.yahoo.com> User-Agent: Mutt/1.5.9i From: elein X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 required=5 tests=[AWL=0.006, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/279 X-Sequence-Number: 23132 I think you want a delete trigger which does your insert and then follows through with the delete by returning old. --elein elein@varlena.com On Tue, Oct 18, 2005 at 09:43:34PM -0700, efa din wrote: > This is my rule for doing the delete event. The rule > can be created. But the problem is, after the record > has been deleted from the 'mytable', this record > cannot be inserted into table 'maytable_log'. > > CREATE RULE on_delete AS ON DELETE TO mytable DO > INSERT INTO mytable_log values (old.id,old.name); > > > > If I add the DO INSTEAD,the record can be inserted > into 'maytable_log' and also still remain in the table > 'maytable'. Which is exactly not exist at all. It just > show it as im using the DO INSTEAD. > > CREATE RULE on_delete AS ON DELETE TO mytable DO > INSTEAD INSERT INTO mytable_log values > (old.id,old.name); > > My problem is, how to insert the deleted record into > table 'mytable_log' without showing it in table > 'maytable'. I really need the solution..please > > > > > > > __________________________________ > Yahoo! Mail - PC Magazine Editors' Choice 2005 > http://mail.yahoo.com > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >