Error with returning SETOF Record
От | A E |
---|---|
Тема | Error with returning SETOF Record |
Дата | |
Msg-id | 20031227194844.23096.qmail@web12108.mail.yahoo.com обсуждение исходный текст |
Ответы |
Re: Error with returning SETOF Record
Re: Error with returning SETOF Record |
Список | pgsql-hackers |
Hi,
I was wondering if a solution was ever found to the error: "wrong record type supplied in RETURN NEXT" when executing a function that returns the Record datatype? I have seen a couple of previous post from Tom Lane and others, but no real resolution.
I am attempting to execute this code and I get that error:
<code>
CREATE FUNCTION tester(varchar) RETURNS SETOF record as'
DECLARE
ft record;
DECLARE
ft record;
begin
FOR ft IN SELECT * FROM visaapplicants LOOP
RETURN NEXT ft;
END LOOP;
return null;
end;'
LANGUAGE 'plpgsql' VOLATILE;
FOR ft IN SELECT * FROM visaapplicants LOOP
RETURN NEXT ft;
END LOOP;
return null;
end;'
LANGUAGE 'plpgsql' VOLATILE;
<calling query>
select * from tester('a') as (c varchar);
<exact error>
ERROR: wrong record type supplied in RETURN NEXT
CONTEXT: PL/pgSQL function "tester" line 6 at return next
CONTEXT: PL/pgSQL function "tester" line 6 at return next
It was just a simple test statement because a larger one is producing the same error, and when I change return next to return it does not return any data even though there are 500 records.
TIA
Alex Erwin
В списке pgsql-hackers по дате отправления: