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