From: | "Lane Van Ingen" <lvaningen(at)esncc(dot)com> |
---|---|
To: | "Michael Fuhr" <mike(at)fuhr(dot)org> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Can't Get SETOF Function to Work |
Date: | 2005-11-02 00:55:05 |
Message-ID: | EKEMKEFLOMKDDLIALABIIEIPCEAA.lvaningen@esncc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
It worked perfectly! Thank you so much for your help!
-----Original Message-----
From: Michael Fuhr [mailto:mike(at)fuhr(dot)org]
Sent: Tuesday, November 01, 2005 7:45 PM
To: Lane Van Ingen
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Can't Get SETOF Function to Work
On Tue, Nov 01, 2005 at 04:38:12PM -0500, Lane Van Ingen wrote:
> Have tried perhaps 20+ alternatives on this plpgsql function, but can't
get
> it to work. Suspect I have done something wrong either with RETURN values,
> creating of a type, or (most likely) use of ROW().
> ...
> CREATE OR REPLACE FUNCTION router_history()
> RETURNS SETOF typ_history_rec_format AS
> $BODY$
> DECLARE
> returnValue RECORD;
Try declaring returnValue as typ_history_rec_format instead of RECORD.
> select into returnValue
ROW(workarea.interface,workarea.updatedTime,
> work_rftype,workarea.rfspeed);
Get rid of the record constructor:
select into returnValue workarea.interface, workarea.updatedTime,
work_rftype, workarea.rfspeed;
Using your code with the above two changes and some canned data, I
got the function to work (where "work" means it ran and returned
some rows -- I didn't look closely at the logic to see if the results
were actually correct ;-).
--
Michael Fuhr
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-11-02 01:08:02 | Re: Index lookup on > and < criteria |
Previous Message | Michael Fuhr | 2005-11-02 00:44:59 | Re: Can't Get SETOF Function to Work |