Re: Newbie Q:"RETURN cannot have a parameter in function returning set"?

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Newbie Q:"RETURN cannot have a parameter in function returning set"?
Дата
Msg-id 20050622003551.GA83681@winnie.fuhr.org
обсуждение исходный текст
Ответ на Newbie Q:"RETURN cannot have a parameter in function returning set"?  (Sigurður Reynisson <siggir@gmail.com>)
Список pgsql-novice
On Tue, Jun 21, 2005 at 08:04:07PM +0000, Sigurður Reynisson wrote:
>
> Warning: pg_query() [function.pg-query]: Query failed: ERROR: RETURN
> cannot have a parameter in function returning set; use RETURN NEXT at
> or near "I" at character 550
...
>  END LOOP;
>  RETURN I;
> END;$BODY$

See "Returning From a Function" in the PL/pgSQL documentation:

http://www.postgresql.org/docs/8.0/static/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-RETURNING

"When a PL/pgSQL function is declared to return SETOF sometype, the
procedure to follow is slightly different.  In that case, the
individual items to return are specified in RETURN NEXT commands,
and then a final RETURN command with no argument is used to indicate
that the function has finished executing."

Change that last "RETURN I" to "RETURN".  PostgreSQL 8 is pickier
about PL/pgSQL syntax than previous versions.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Raise Notice
Следующее
От: Kirti Pankhania
Дата:
Сообщение: Ubuntu problems with Postgres install