Re: Function returning SETOF returns nothing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Coby Beck <coby101(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Function returning SETOF returns nothing
Date: 2012-04-05 01:43:50
Message-ID: 18710.1333590230@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Coby Beck <coby101(at)gmail(dot)com> writes:
> Thanks for the advice, Tom...I am still having trouble as many
> variations tried all give compile errors.

More modern versions give a more useful error message:

ERROR: RETURN NEXT must specify a record or row variable in function returning row
LINE 4: RETURN NEXT (SELECT ''old'' as type, ''item'' as item, '...
^

So what you need to do is declare a variable of type ForecastData,
assign into the fields of that variable, and then "RETURN NEXT varname".

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Coby Beck 2012-04-05 04:46:19 Re: Function returning SETOF returns nothing
Previous Message Coby Beck 2012-04-05 00:57:53 Re: Function returning SETOF returns nothing