pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bart Degryse <Bart.Degryse@indicator.be>
To: pgsql-sql@postgresql.org
Subject: Re: perlu: did I find a bug, or did I make one?
Date: Mon, 04 Jun 2007 16:58:43 +0200
Message-ID: <466444C2.A3DD.0030.0@indicator.be> (raw)
In-Reply-To: <19467.1180968768@sss.pgh.pa.us>
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>

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 = 'lil' and two with dataareaid = '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"();
>  
> CREATE OR REPLACE FUNCTION "public"."temp_func1" () RETURNS trigger AS
> $body$
> BEGIN
>   IF NEW.dataareaid =3D 'lil' THEN
>     RAISE EXCEPTION '% foutje %', NEW.dataareaid, NEW.name;
>   elsIF NEW.dataareaid =3D '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

view thread (3+ messages)

Message-ID: <466444C2.A3DD.0030.0@indicator.be>
Permalink:  ../466444C2.A3DD.0030.0@indicator.be/
Also on:    postgresql.org/message-id/466444C2.A3DD.0030.0@indicator.be

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Bart.Degryse@indicator.be
  Subject: Re: perlu: did I find a bug, or did I make one?
  In-Reply-To: <466444C2.A3DD.0030.0@indicator.be>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox