Search Postgresql Archives

Re: No return from trigger function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx / aim:depeszhdl / skype:depesz_hdl / gg:6749007

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux