Re: Request for change in PL/PGSQL function handler

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Request for change in PL/PGSQL function handler
Дата
Msg-id 3462.980535840@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Request for change in PL/PGSQL function handler  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-sql
Josh Berkus <josh@agliodbs.com> writes:
>     Currently (7.0.3) the PLPGSQL function compiler permits only one RETURN
> statment, at the end of the function.  RETURN statements placed
> elsewhere cause a compile error.

Say what?

regression=# create function foo(int) returns int as '
regression'# begin
regression'#   if $1 > 10 then return $1;
regression'#   end if;
regression'#   return $1 - 1;
regression'# end;' language 'plpgsql';
CREATE
regression=# select foo(1);foo
-----  0
(1 row)

regression=# select foo(100);foo
-----100
(1 row)

regression=#

Works fine for me in both 7.0.2 and current.
        regards, tom lane


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

Предыдущее
От: Jan Wieck
Дата:
Сообщение: Re: Rule not invoked in 7.1
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Request for change in PL/PGSQL function handler