Re: date range to set of dates expansion

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Samuel Gendler <sgendler(at)ideasculptor(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk>
Subject: Re: date range to set of dates expansion
Date: 2012-01-19 19:42:12
Message-ID: 4F187214.1010306@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 01/19/2012 09:17 AM, Samuel Gendler wrote:
>
>
> On Thu, Jan 19, 2012 at 8:20 AM, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com
> <mailto:adrian(dot)klaver(at)gmail(dot)com>> wrote:
>
> On Thursday, January 19, 2012 7:59:27 am Gary Stainburn wrote:
> > The following code works in 8.4 but not 8.3.
> > Anyone know why, or what I need to do to change it?
> >
> > SELECT aid, asid,
> > date_range (asdate, afdate)::date AS asdate,
> > acomments
> > FROM availability
> >
> > In 8.4 it returns the expanded dataset as required. In 8.3 I get:
> >
> > ERROR: set-valued function called in context that cannot accept
> a set
> > CONTEXT: PL/pgSQL function "date_range" line 4 at RETURN NEXT
>
> As to why it works in 8.4 vs 8.3
>
> http://www.postgresql.org/docs/8.4/interactive/release-8-4.html
>
> "Support set-returning functions in SELECT result lists even for
> functions that
> return their result via a tuplestore (Tom)
>
> In particular, this means that functions written in PL/pgSQL and
> other PL
> languages can now be called this way.'
>
> In 8.3- I believe you could only call it as
>
> SELECT * from date_range (asdate, afdate)::date AS asdate;
>
>
> I don't think you can have that cast there when it is in the
> from-clause.

That was a cut and paste error on my part, I just copied that line from
the original query.

>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jasen Betts 2012-01-20 13:29:59 Re: Token separation
Previous Message Gary Stainburn 2012-01-19 17:27:27 Re: date range to set of dates expansion