Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id D1F909FB5BB for ; Mon, 4 Jun 2007 11:59:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 12327-08-2 for ; Mon, 4 Jun 2007 11:58:58 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from interscan.indicator.com (mail.indicator.be [193.121.199.3]) by postgresql.org (Postfix) with ESMTP id 123939FB533 for ; Mon, 4 Jun 2007 11:58:57 -0300 (ADT) Received: from webaccess.indicator.be ([10.100.1.7]) by interscan.indicator.com with InterScan Message Security Suite; Mon, 04 Jun 2007 16:44:02 +0200 Received: from DOMEXT-MTA by webaccess.indicator.bewith Novell_GroupWise; Mon, 04 Jun 2007 16:58:55 +0200 Message-Id: <466444C2.A3DD.0030.0@indicator.be> X-Mailer: Novell GroupWise Internet Agent 7.0.1 Date: Mon, 04 Jun 2007 16:58:43 +0200 From: "Bart Degryse" To: Subject: Re: perlu: did I find a bug, or did I make one? References: <465D44F3.A3DD.0030.0@indicator.be><20070530141349.GA76707@winni e.fuhr.org><466405B4.A3DD.0030.0@indicator.be><466405B4.A3DD.0030.0@indicat or.be><19467.1180968768@sss.pgh.pa.us> In-Reply-To: <19467.1180968768@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=__PartD1F6FEB3.0__=" X-imss-version: 2.047 X-imss-result: Passed X-imss-approveListMatch: *@indicator.be X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.448 tagged_above=0 required=5 tests=AWL=-0.064, BAYES_50=0.001, FORGED_RCVD_HELO=0.135, HTML_30_40=0.374, HTML_MESSAGE=0.001, UNPARSEABLE_RELAY=0.001, UPPERCASE_25_50=0 X-Spam-Level: X-Archive-Number: 200706/13 X-Sequence-Number: 28503 --=__PartD1F6FEB3.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Well, actually I do. If there's any error, I want nothing done. But my real point was that although there are 2 records in my source table = with dataareaid =3D 'lil' and two with dataareaid =3D 'bol' I still get 4 = times the 'lil' error message, while I was expecting 2 times the 'lil' = error message and two times the 'bol' error message. >>> Tom Lane 2007-06-04 16:52 >>> "Bart Degryse" writes: > CREATE TRIGGER "afh_test_tr" BEFORE INSERT=20 > ON "public"."afh_test" FOR EACH ROW=20 > EXECUTE PROCEDURE "public"."temp_func1"(); > =20 > CREATE OR REPLACE FUNCTION "public"."temp_func1" () RETURNS trigger AS > $body$ > BEGIN > IF NEW.dataareaid =3D3D 'lil' THEN > RAISE EXCEPTION '% foutje %', NEW.dataareaid, NEW.name; > elsIF NEW.dataareaid =3D3D 'bol' THEN > RAISE EXCEPTION '% nog een foutje %', NEW.dataareaid, NEW.name; > END IF; > RETURN NULL; > END; > $body$ > LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; You probably don't want this trigger doing RETURN NULL; that's turning all your inserts into no-ops. regards, tom lane --=__PartD1F6FEB3.0__= Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Description: HTML
Well, actually I do. If there's any error, I want nothing done.
But my real point was that although there are 2 records in my source = table with dataareaid =3D 'lil' and two with dataareaid =3D 'bol' I still = get 4 times the 'lil' error message, while I was expecting 2 times the = 'lil' error message and two times the 'bol' error message.

>>> Tom Lane <tgl@sss.pgh.pa.us> 2007-06-04 16:52 = >>>
"Bart Degryse" <Bart.Degryse@indicator.be> writes:> CREATE TRIGGER "afh_test_tr" BEFORE INSERT
> ON "public"."afh_= test" FOR EACH ROW
> EXECUTE PROCEDURE "public"."temp_func1"();
&= gt; 
> CREATE OR REPLACE FUNCTION "public"."temp_func1" () = RETURNS trigger AS
> $body$
> BEGIN
>   IF = NEW.dataareaid =3D3D 'lil' THEN
>     RAISE = EXCEPTION '% foutje %', NEW.dataareaid, NEW.name;
>   = elsIF NEW.dataareaid =3D3D 'bol' THEN
>     = RAISE EXCEPTION '% nog een foutje %', NEW.dataareaid, NEW.name;
>&nbs= p;  END IF;
>   RETURN NULL;
> END;
> = $body$
> LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY = INVOKER;

You probably don't want this trigger doing RETURN NULL; = that's
turning all your inserts into no-ops.

regards, tom = lane
--=__PartD1F6FEB3.0__=--