Re: No return from trigger function

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: No return from trigger function
Дата
Msg-id 20090408201655.GA29224@depesz.com
обсуждение исходный текст
Ответ на Re: No return from trigger function  ("James B. Byrne" <byrnejb@harte-lyne.ca>)
Список 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@depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

В списке pgsql-general по дате отправления:

Предыдущее
От: "James B. Byrne"
Дата:
Сообщение: Re: No return from trigger function
Следующее
От: "James B. Byrne"
Дата:
Сообщение: Re: No return from trigger function