Search Postgresql Archives

Re: Fwd: Set-valued function in wrong context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux