Sorry but this didn't help ... Can not return next ... so I changed the returns as too but same effect as the first function:
drop table foo; create table foo(sirname text, name text); insert into foo values ('Mueller', 'Marcus'); drop function getfoo(char(1)); create or replace function getfoo(char(1)) returns setof refcursor as ' declare ref refcursor; begin open ref for select * from foo where sirname like ''%'' || $1 || ''%''; return next ref; end; ' LANGUAGE 'plpgsql' VOLATILE; select * from getfoo('M'); -- fetch all in '<unnamed portal 14>'; ERROR: syntax error at or near "'<unnamed portal 14>'" at character 15 -- cu Chris Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kanns mit allen: http://www.gmx.net/de/go/multimessenger ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match