Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 434CD475AFF for ; Mon, 9 Dec 2002 15:02:42 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 8A058475A1E for ; Mon, 9 Dec 2002 15:02:41 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2273542; Mon, 09 Dec 2002 12:02:42 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Ian Harding" , Subject: Re: Rules/Trigges Trade-offs Date: Mon, 9 Dec 2002 12:06:09 -0800 X-Mailer: KMail [version 1.4] Cc: , References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212091206.09064.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/101 X-Sequence-Number: 10689 Ian, > Anyway, I have a similar requirement, to intercept insert/update/delete a= nd=20 redirect the data if a condition is met. Right now I am trying an INSTEAD= =20=20 rule that puts the condtion in the WHERE of the rule definition. It seems = to=20 work OK, but if the condition has exeptions where I would like to throw an= =20 error, I can't. And since it is an INSTEAD, I can't have a trigger on the= =20 table fire to find the exception cases. Urgh. I'd suggest a "DO INSTEAD SELECT some_function(NEW)" where some_function is a function that tests for errors, throws and excepti= on=20 if necessary, otherwise inserts. It's tricky, but probably the best way to= =20 get trigger + rule functionality at once. --=20 -Josh Berkus Aglio Database Solutions San Francisco