From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Jan Cruz <malebug(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: PostgreSQL Functions / PL-Language |
Date: | 2006-02-20 07:07:11 |
Message-ID: | 20060220070711.GA31482@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Virag Saksena | 2006-02-20 07:24:57 | psql Copy question |
Previous Message | Jan Cruz | 2006-02-20 06:36:04 | Re: PostgreSQL Functions / PL-Language |