pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: bricklen <bricklen@gmail.com>
Cc: jonathan.camile <jonathan.camile@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8629: Strange resultset when using CTE or a subselect
Date: Tue, 26 Nov 2013 12:22:08 -0500
Message-ID: <9529.1385486528@sss.pgh.pa.us> (raw)
In-Reply-To: <CAGrpgQ8J_QRvXXkSK+AqYeRLg4m2goDNucXaJ05jy2iPpnE3zA@mail.gmail.com>
References: <E1VktOG-0004bJ-16@wrigleys.postgresql.org>
	<1385408337668-5780199.post@n5.nabble.com>
	<1385459415878-5780294.post@n5.nabble.com>
	<CAGrpgQ8J_QRvXXkSK+AqYeRLg4m2goDNucXaJ05jy2iPpnE3zA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

bricklen <bricklen@gmail.com> writes:
> On Tue, Nov 26, 2013 at 1:50 AM, jonathan.camile
> <jonathan.camile@gmail.com>wrote:
>> I always have the same last result regardless of the offset or the limit I
>> use.

> I cannot reproduce your problem in 9.2.5 nor 9.3.1. Rerunning the query
> with different OFFSET values gives me different results each time.

I do reproduce the behavior, at least when offset+limit is small enough
that the executor will use a top-N heapsort.  As already stated, it's
not a bug; the ordering is underdetermined so any set of the correct
number of rows with status = 5 is a valid output.  As for what's actually
happening: the row that always shows up seems to be the physically first
one with status = 5.  I think that's starting out as the top of the top-N
heap, and it just stays there because there's nothing that can displace
it.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (10+ messages)  latest in thread

Message-ID: <9529.1385486528@sss.pgh.pa.us>
Permalink:  ../9529.1385486528@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9529.1385486528@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bricklen@gmail.com, jonathan.camile@gmail.com
  Subject: Re: BUG #8629: Strange resultset when using CTE or a subselect
  In-Reply-To: <9529.1385486528@sss.pgh.pa.us>
  References: <E1VktOG-0004bJ-16@wrigleys.postgresql.org> <1385408337668-5780199.post@n5.nabble.com> <1385459415878-5780294.post@n5.nabble.com> <CAGrpgQ8J_QRvXXkSK+AqYeRLg4m2goDNucXaJ05jy2iPpnE3zA@mail.gmail.com> <9529.1385486528@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox