X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 4B6E630D1A6 for ; Fri, 13 Jun 2003 11:51:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 02166-09 for ; Fri, 13 Jun 2003 08:50:51 -0300 (ADT) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id 7792430D18F for ; Fri, 13 Jun 2003 08:50:47 -0300 (ADT) Received: (qmail 7030 invoked by uid 65534); 13 Jun 2003 11:50:47 -0000 Received: from pD9E6D2F1.dip.t-dialin.net (HELO wxp) (217.230.210.241) by mail.gmx.net (mp023) with SMTP; 13 Jun 2003 13:50:47 +0200 Message-ID: <046801c331a2$0c483e70$a07ba8c0@wxp> From: "Albrecht Berger" To: "pgsql" Subject: trigger : emulate "instead of" with before ? Date: Fri, 13 Jun 2003 13:50:54 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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-Spam-Status: No, hits=3.0 tagged_above=0.0 required=5.0 tests=FROM_ENDS_IN_NUMS, RCVD_IN_NJABL, RCVD_IN_OSIRUSOFT_COM, UPPERCASE_25_50 X-Spam-Level: *** X-Archive-Number: 200306/120 X-Sequence-Number: 13878 Hello, I need a trigger which is updating a delete flag of a row instead of deleting it physically. How do I implement a trigger which doesn't execute a delete without raising an exception in plsql ? CREATE TRIGGER trigger1 BEFORE DELETE ON table1 FOR EACH ROW EXECUTE PROCEDURE setDeleteFlag (); If I use RAISE EXCEPTION "..." the delete statement isn't executed, but I think the transaction is rolled back too, am I right ? So what is the best way to implement something (Oracle like) like that : CREATE TRIGGER trigger1 INSTEAD OF DELETE ON table1 FOR EACH ROW EXECUTE PROCEDURE setDeleteFlag (); thx