Title: BUGs for function returning a SETOF values on linux postgres 8.0.4, the same function runs correctly on win postgres 8.1

TITLE:
BUGs for function returning a SETOF values on linux postgres 8.0.4, the same function with the same table runs correctly on win postgres 8.1

Dear Sir/Madam,
   I am trying to run a very simple test on the above version. This test works fine on my window 8.1 version.
If I am taking out the function on the 8.0.4 version on linux as just the select (SELECT DISTINCT value FROM colors) I can see the results. If run via a function call I got the following error:

Failed to execute SQL : SQL select * from tt();  failed : ERROR: control reached end of function without RETURN CONTEXT: PL/pgSQL function "tt"

Please help to identify if this is a bug. Details attached.
Many thanks.
Susan

-- Type definition
CREATE TYPE otyperow AS
   (f varchar);

-- Function definition
CREATE OR REPLACE FUNCTION tt()
  RETURNS SETOF otyperow AS
$BODY$
DECLARE
        oRow      oTypeRow;
     BEGIN
         FOR oRow in SELECT DISTINCT value FROM colors LOOP
             return next oRow;
         END LOOP;
END;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;

-- call the defined function
select * from tt();

-- Table field in colors table is a varchar(16).




Reply via email to