Re: BUG #8629: Strange resultset when using CTE or a subselect - Mailing list pgsql-bugs

From Jonathan Camile
Subject Re: BUG #8629: Strange resultset when using CTE or a subselect
Date
Msg-id CAOrxoaFNsZunmGgg137k+mdOBXRO64hNsFZ7_iMDqv=oX=Cbbw@mail.gmail.com
Whole thread Raw
In response to Re: BUG #8629: Strange resultset when using CTE or a subselect  (bricklen <bricklen@gmail.com>)
Responses Re: BUG #8629: Strange resultset when using CTE or a subselect  (bricklen <bricklen@gmail.com>)
List pgsql-bugs
Hi,

I tried with OFFSET before LIMIT but I have the same problem.
It's always the same record that I have last.


--

Jonathan Camile


On 25 November 2013 18:32, bricklen <bricklen@gmail.com> wrote:

>
> On Mon, Nov 25, 2013 at 2:27 AM, <jonathan.camile@gmail.com> wrote:
>>
>> WITH filtred_table AS (
>>     SELECT c.id
>>     FROM my_table t
>>     WHERE t.enabled = true
>>     AND (t.hdata->'field')::integer = ANY ('{16788}')
>> )
>> SELECT my_table.id
>> FROM  my_table
>> WHERE mycontract.id IN (SELECT filtred_table.id FROM filtred_table)
>> ORDER BY my_table.hdata->'field' DESC
>> LIMIT 5
>> OFFSET 5
>>
>
>
> Try with OFFSET 5 LIMIT 5. The offset should be applied *before* the LIMIT.
>

pgsql-bugs by date:

Previous
From: bricklen
Date:
Subject: Re: BUG #8629: Strange resultset when using CTE or a subselect
Next
From: David Johnston
Date:
Subject: Re: BUG #8629: Strange resultset when using CTE or a subselect