Re: BUG #8629: Strange resultset when using CTE or a subselect

From: bricklen <bricklen(at)gmail(dot)com>
To: "jonathan(dot)camile" <jonathan(dot)camile(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8629: Strange resultset when using CTE or a subselect
Date: 2013-11-26 16:52:04
Message-ID: CAGrpgQ8J_QRvXXkSK+AqYeRLg4m2goDNucXaJ05jy2iPpnE3zA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Nov 26, 2013 at 1:50 AM, jonathan.camile
<jonathan(dot)camile(at)gmail(dot)com>wrote:

>
> Here a query to create table with which I can reproduce this behavior :
>
> CREATE TABLE public.testme AS SELECT generate_series(134800, 348008) as id,
> trunc(random() * 9 + 1) as status;
>
> Then if you play with the following query, you will reproduce it.
>
> WITH filtred_test AS (
> SELECT c.id
> FROM public.testme c
> WHERE c.status = ANY ('{5}')
> )
> SELECT mytest.id, mytest.status
> FROM public.testme mytest
> WHERE mytest.id IN (SELECT filtred_test.id FROM filtred_test)
> ORDER BY mytest.status DESC
> OFFSET 35
> LIMIT 10
>
> 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.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2013-11-26 17:22:08 Re: BUG #8629: Strange resultset when using CTE or a subselect
Previous Message Tom Lane 2013-11-26 16:50:09 Re: BUG #8628: md5 security hole