Re: BUG #9010: partition by overrides order by in window functions

From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #9010: partition by overrides order by in window functions
Date: 2014-01-28 22:34:37
Message-ID: 1390948477557-5789377.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

markella.skempri wrote
> 1 2011-08-20 2011-08-21 1
> 1 2011-08-21 2011-08-27 6
> 1 2011-08-27 2011-08-28 1
> 1 2011-08-28 2011-08-29 1
> 1 2011-08-29 2011-08-30 1
>
> 1 2011-08-20 2011-08-21 1
> 1 2011-08-27 2011-08-28 1 7
> 1 2011-08-21 2011-08-27 6 1
> 1 2011-08-28 2011-08-29 1 1
> 1 2011-08-29 2011-08-30 1 2

Yes, partitioning occurs before ordering. The syntax itself suggests that.

Can you explain why you expect the 27-28 row to belong to the "first" group
and not the "third"?

If that is a typo then you are looking for contiguous blocks with the same
gap-size. Once you've identified those blocks you can then partition on
them and performing your row_number.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-9010-partition-by-overrides-order-by-in-window-functions-tp5789343p5789377.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message cezary.dowhan 2014-01-29 10:21:39 BUG #9026: National characters in the user profile name
Previous Message Tom Lane 2014-01-28 21:00:44 Re: BUG #9010: partition by overrides order by in window functions