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 1705CD9F83 for ; Wed, 19 Oct 2005 01:43:38 -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 99643-10 for ; Wed, 19 Oct 2005 04:43:34 +0000 (GMT) Received: from web33302.mail.mud.yahoo.com (web33302.mail.mud.yahoo.com [68.142.206.117]) by svr1.postgresql.org (Postfix) with SMTP id C8C0CD9F77 for ; Wed, 19 Oct 2005 01:43:34 -0300 (ADT) Received: (qmail 51092 invoked by uid 60001); 19 Oct 2005 04:43:34 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=u7BH97OAWQbYlkVuAkv1WM7b5wEB0CWf6CToSKiNJ18llO22f0KVi4tfsCNr3qAw9rqDhrYaTmL0YSoPHMwAKXN7GAe0jVC5OhMo65ewhjIGA2J4UfLc7gHVP+OHRFqa/BWmvePB7anZw47UFvjXYsjYQsPQ1vS/nQh4MRW+8gU= ; Message-ID: <20051019044334.51090.qmail@web33302.mail.mud.yahoo.com> Received: from [60.48.18.194] by web33302.mail.mud.yahoo.com via HTTP; Tue, 18 Oct 2005 21:43:34 PDT Date: Tue, 18 Oct 2005 21:43:34 -0700 (PDT) From: efa din Subject: how to create rule as on delete To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.251 required=5 tests=[DNS_FROM_RFC_ABUSE=0.374, FROM_ENDS_IN_NUMS=0.516, FROM_HAS_ULINE_NUMS=0.361] X-Spam-Level: * X-Archive-Number: 200510/264 X-Sequence-Number: 23117 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