Re: [HACKERS] Query started showing wrong result after Ctrl+c - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject Re: [HACKERS] Query started showing wrong result after Ctrl+c
Date
Msg-id CAL9smLCC32F-f61OZu3nA16sqES-7vbvEvYdcmckBR=mqRisTA@mail.gmail.com
Whole thread Raw
In response to [HACKERS] Query started showing wrong result after Ctrl+c  (tushar <tushar.ahuja@enterprisedb.com>)
Responses Re: [HACKERS] Query started showing wrong result after Ctrl+c
List pgsql-hackers
On Thu, Oct 12, 2017 at 12:03 PM, tushar <tushar.ahuja@enterprisedb.com> wrote:
postgres=# SELECT  *  FROM ( SELECT n   from  tv  where n= (select * from (select n from tv limit 1) c)) as c  ;
  n
------
 3713
(1 row)

This time , query is started showing wrong result.  Is this an expected behavior and if yes -then how to get the correct result ?

The subquery:

    select n from tv limit 1

could in theory return any row due to the lack of ORDER BY.  What I'm guessing happened is that you're seeing a synchronized sequential scan in follow-up queries.  Add an ORDER BY.


.m

pgsql-hackers by date:

Previous
From: tushar
Date:
Subject: [HACKERS] Query started showing wrong result after Ctrl+c
Next
From: tushar
Date:
Subject: Re: [HACKERS] Query started showing wrong result after Ctrl+c