Re: Fwd: Set-valued function in wrong context

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Fwd: Set-valued function in wrong context
Дата
Msg-id 20081009131748.O71903@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Fwd: Set-valued function in wrong context  (Raymond O'Donnell <rod@iol.ie>)
Ответы Re: Fwd: Set-valued function in wrong context  (Raymond O'Donnell <rod@iol.ie>)
Список pgsql-general
On Thu, 9 Oct 2008, Raymond O'Donnell wrote:

> gfc_bookings=# select * from make_time_series('11:00', '14:00', 30);
> ERROR:  set-valued function called in context that cannot accept a set
> CONTEXT:  PL/pgSQL function "make_time_series" line 10 at for over
> select rows
>
> Now, I know what the error means, and I reckon it's because of the
> cast(), but for the life of me I can't see what to do about it. Any help
> will be appreciated...

>   for ATime in
>     select start_time + s.a
>     from cast(generate_series(0, TotalMins, mins_delta) || ' minutes' as
> interval) as s(a)

I think you'd end up wanting something like:
 FROM ( select a * interval '1 minute' from generate_series(0, TotalMins,
mins_delta) as s(a) ) as s(a)

I changed the concatenation and cast into an interval multiply, but you
could easily do things the other way as well.


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

Предыдущее
От: Martin Pitt
Дата:
Сообщение: Re: [Pkg-postgresql-public] Postgres major version support policy on Debian
Следующее
От: Raymond O'Donnell
Дата:
Сообщение: Re: Fwd: Set-valued function in wrong context