Re: Nested window functions not permitted

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Nested window functions not permitted
Date: 2015-11-08 22:51:47
Message-ID: 1447023107.4444.29.camel@phoenix
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 2015-11-08 at 17:50 -0500, Tom Lane wrote:
> Oliver Elphick <olly(at)lfix(dot)co(dot)uk> writes:
> > I tried to do this:
> > SELECT p.company, p.start, p.yearend, p.idnum,
> > s.pdno, s.pdend,
> > CASE WHEN nth_value(s.pdend,(row_number() OVER w)::INTEGER -1) OVER w IS NULL
> > THEN p.start
> > ELSE nth_value(s.pdend,(row_number() OVER w)::INTEGER -1) + '1 day'::INTERVAL
>
> Um, don't you just want lead() or lag()?
>
> regards, tom lane

So I do! Thanks.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-11-09 03:21:12 Re: Error when test on DBT2 Postgresql
Previous Message Tom Lane 2015-11-08 22:50:12 Re: Nested window functions not permitted