Re: Why can't I use windowing functions over ordered aggregates?

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: cedric(at)2ndquadrant(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why can't I use windowing functions over ordered aggregates?
Date: 2013-06-21 17:12:04
Message-ID: 51C48964.1050100@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Cedric,

> See this example:
> # create table foo (i int, t timestamptz);
> # insert into foo select n, now() from generate_series(1,10) g(n);
> # select i, first_value(i) over (order by t desc) from foo;
> # select i, first_value(i) over (order by t desc ROWS between 0 PRECEDING and
> UNBOUNDED FOLLOWING) from foo;
>
> What do you expect "SELECT first(val order by ts desc)" to output ?
>

Ah, right, I see what you mean. Yeah, I was doing queries without peer
rows, so it looked the same to me, and it uses some of the same
machinery. But of course it's not completely the same.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2013-06-21 17:48:35 Review [was Re: MD5 aggregate]
Previous Message David Johnston 2013-06-21 17:09:20 Re: Why can't I use windowing functions over ordered aggregates?