Home > Archive > PostgreSQL Bugs > December 2005 > BUGs for function returning a SETOF values on linux postgres 8.0.4, the same function runs correctl









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author BUGs for function returning a SETOF values on linux postgres 8.0.4, the same function runs correctl
Susan Fu

2005-12-01, 11:24 am

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).





Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com