Re: No return from trigger function

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: "James B(dot) Byrne" <byrnejb(at)harte-lyne(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: No return from trigger function
Date: 2009-04-08 20:16:55
Message-ID: 20090408201655.GA29224@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 08, 2009 at 04:13:58PM -0400, James B. Byrne wrote:
> Does this mean that the example given on pg. 798 of the manual is in
> error, or have I misread it?
> BEGIN
> EXCEPTION
> WHEN UNIQUE_VIOLATION THEN
> -- do nothing
> END;

please notice that the BEGIN.... EXCEPTION ... END; are withing main
function BEGIN END.
so it has to be like this:

create function x() returns ... as $$
declare
begin
whatever;
begin
do something
exception
end;
whatever;
end;
$$ language plpgsql;

notice 2 pairs of begin/end.

depesz

--
Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
jid/gtalk: depesz(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

In response to

Browse pgsql-general by date

  From Date Subject
Next Message James B. Byrne 2009-04-08 20:19:18 Re: No return from trigger function
Previous Message James B. Byrne 2009-04-08 20:13:58 Re: No return from trigger function