Re: BUG #13790: last row of limit/offset result produces duplicates - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #13790: last row of limit/offset result produces duplicates
Date
Msg-id CAKFQuwatYOTvMuCrZQ3N9z16A9FYoeY5CtRq9XiLwgyhZ4dG_g@mail.gmail.com
Whole thread Raw
In response to BUG #13790: last row of limit/offset result produces duplicates  (pbelbin@gmail.com)
List pgsql-bugs
On Wed, Dec 2, 2015 at 2:02 PM, <pbelbin@gmail.com> wrote:

> select * from demo1 order by code limit 5 offset 10
>
> 18;CHCG;240
> 19;CHCG;248
> 20;CHCG;250
> 14;CHCG;224
> 10;CHCG;216
>
> and then:
>
> select * from demo1 order by code limit 5 offset 20
>
> 28;CHCG;289
> 29;CHCG;301
> 30;CHCG;302
> 14;CHCG;224
> 10;CHCG;216
>
>
> the last row of the two result sets above is the same row!
>
> changing the sorting so that it includes the match column appears to avoi=
d
> the issue, but, this is a bug.  each row should only appear once if the
> limit/offset values are looking at different portions of the result that
> would be produced without the limit/offset options
> =E2=80=8B.
>

I'm sorry but no, that is not how this works.  The two queries are
independent and if you fail to adequately specify the ORDER BY the fault is
yours, not the system's.

David J.

pgsql-bugs by date:

Previous
From: digoal@126.com
Date:
Subject: BUG #13791: postgresql 9.5 beta2 brin bug (cann't auto update)
Next
From: Tom Lane
Date:
Subject: Re: BUG #13790: last row of limit/offset result produces duplicates