From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Raymond O'Donnell <rod(at)iol(dot)ie> |
Cc: | 'PostgreSQL' <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Fwd: Set-valued function in wrong context |
Date: | 2008-10-09 20:25:15 |
Message-ID: | 20081009131748.O71903@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Raymond O'Donnell | 2008-10-09 20:31:06 | Re: Fwd: Set-valued function in wrong context |
Previous Message | Martin Pitt | 2008-10-09 20:15:27 | Re: [Pkg-postgresql-public] Postgres major version support policy on Debian |