Re: PostgreSQL Functions / PL-Language

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: PostgreSQL Functions / PL-Language
Дата
Msg-id 20060220070711.GA31482@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: PostgreSQL Functions / PL-Language  ("Jan Cruz" <malebug@gmail.com>)
Список pgsql-general
On Mon, Feb 20, 2006 at 02:36:04PM +0800, Jan Cruz wrote:
> BTW I also got something like this:
>
> CREATE FUNCTION func2() RETURNS SETOF foo as $$
> DECLARE
> row foo;
> BEGIN
>   SELECT INTO ROW * from FOO;
>    return next foo;
> END;
> $$ LANGUAGE plpgsql STABLE;

Please post the actual code instead of "something like" it.  Trying
to create the above function fails; I'm guessing you really have
"return next row" instead of "return next foo".

> select * from func2();
>
> It did return the 2 rows (all rows) when I first test it.
> Then today I tried the same function  and test it then it return only 1 row.

As written the function above should return only one row because
it doesn't loop through the results.  I suspect the difference
between the earlier test and the most recent one is that you removed
the loop.

--
Michael Fuhr

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

Предыдущее
От: "Jan Cruz"
Дата:
Сообщение: Re: PostgreSQL Functions / PL-Language
Следующее
От: "Virag Saksena"
Дата:
Сообщение: psql Copy question