Re: Can't Get SETOF Function to Work

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Can't Get SETOF Function to Work
Дата
Msg-id 20051102004459.GA88879@winnie.fuhr.org
обсуждение исходный текст
Ответ на Can't Get SETOF Function to Work  ("Lane Van Ingen" <lvaningen@esncc.com>)
Ответы Re: Can't Get SETOF Function to Work  ("Lane Van Ingen" <lvaningen@esncc.com>)
Список pgsql-sql
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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: Nested Table in PostgreSQL or some alternative Variants
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Index lookup on > and < criteria