Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W8HEv-00041u-Fw for pgsql-bugs@arkaria.postgresql.org; Tue, 28 Jan 2014 22:34:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W8HEu-0000m6-RN for pgsql-bugs@arkaria.postgresql.org; Tue, 28 Jan 2014 22:34:40 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W8HEt-0000m0-Vl for pgsql-bugs@postgresql.org; Tue, 28 Jan 2014 22:34:40 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W8HEr-0005z8-Rl for pgsql-bugs@postgresql.org; Tue, 28 Jan 2014 22:34:39 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1W8HEr-0007gP-IY for pgsql-bugs@postgresql.org; Tue, 28 Jan 2014 14:34:37 -0800 Date: Tue, 28 Jan 2014 14:34:37 -0800 (PST) From: David Johnston To: pgsql-bugs@postgresql.org Message-ID: <1390948477557-5789377.post@n5.nabble.com> In-Reply-To: <20140128175229.8089.55168@wrigleys.postgresql.org> References: <20140128175229.8089.55168@wrigleys.postgresql.org> Subject: Re: BUG #9010: partition by overrides order by in window functions MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 4.5 (++++) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs