Re: Error with returning SETOF Record

From: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
To: A E <cooljoint(at)yahoo(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Error with returning SETOF Record
Date: 2003-12-29 08:31:09
Message-ID: Pine.LNX.4.44.0312290930210.30126-100000@kix.fsv.cvut.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 27 Dec 2003, A E wrote:

> 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;
> begin
> FOR ft IN SELECT * FROM visaapplicants LOOP
> RETURN NEXT ft;
> END LOOP;
> return null;

You have to write only return!

> end;'
> LANGUAGE 'plpgsql' VOLATILE;
>
Regards Pavel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Kirkwood 2003-12-29 08:35:32 Re: *sigh*
Previous Message Shridhar Daithankar 2003-12-29 07:38:18 Re: [GENERAL] Is my MySQL Gaining ?