Re: using window functions

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: using window functions
Date: 2009-03-17 08:00:59
Message-ID: gpnlbr$4hn$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Daniel Manesajian, 17.03.2009 04:33:
> Hi,
>
> I'm trying to get an advance taste of the window function feature that I
> believe is supposed to be in 8.4. I'm running 8.4devel snapshot (dated
> Jan-01 which seems kind of old) grabbed from the snapshot page on the
> postgresql website.
>
> When I try a simple query "select avg(my_int) over (order by my_int rows
> unbounded preceding) order by 1;" I get an error:
>
> ERROR: syntax error at or near "over"
>
> Do I have to build from source to try window functions?
>

I'm using the build from January 1st (on Windows, provided by EnterpriseDB) and your statement gives me an error at the keyword "unbounded". If I leave that out or add the missing range, it works.

Are you sure you are connecting to the correct installation?

Btw: I'm not sure whether your statement makes sense. As you are not using partion by or selecting other columns from the table, the same could be achieved without a window function. But I guess you just wanted to play around ;)

Thomas

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2009-03-17 08:01:51 Re: Postgres 8.2.x support on Windows 2008
Previous Message Craig Ringer 2009-03-17 06:59:55 Re: What are the benefits of using a clustered index?