Re: [HACKERS] Re: Question regarding new windowing functions in 8.4devel

From: David Fetter <david(at)fetter(dot)org>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: [HACKERS] Re: Question regarding new windowing functions in 8.4devel
Date: 2009-01-16 17:33:06
Message-ID: 20090116173306.GC20296@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Fri, Jan 16, 2009 at 12:23:16PM -0500, Jaime Casanova wrote:
> On Fri, Jan 16, 2009 at 12:07 PM, David Fetter <david(at)fetter(dot)org> wrote:
> >>
> >> Now i want only 3 records for every typ:
> >>
> >> test=# select typ, ts, rank() over (partition by typ order by ts desc ) from foo where rank <= 3;
> >> ERROR: column "rank" does not exist
> >> LINE 1: ...rtition by typ order by ts desc ) from foo where rank <= 3;
>
> maybe the rank should go in a having clause? i'm not familiar about
> window functions yet... just guessing...

I tried HAVING, too, and it's epic fail. :(

> > ERROR: syntax error at or near "WHERE"
> > LINE 8: WHERE
> > ^
>
> the WINDOW specification goes after the WHERE clause not before

Thanks :)

Still remaining is our inability to limit windowing functions other
than via subselect or equivalently CTEs. I believe this is a bug.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-01-16 17:34:34 Re: Question regarding new windowing functions in 8.4devel
Previous Message Jaime Casanova 2009-01-16 17:23:16 Re: [HACKERS] Re: Question regarding new windowing functions in 8.4devel

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-01-16 17:34:34 Re: Question regarding new windowing functions in 8.4devel
Previous Message Jaime Casanova 2009-01-16 17:23:16 Re: [HACKERS] Re: Question regarding new windowing functions in 8.4devel