Query started showing wrong result after Ctrl+c

From: tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Query started showing wrong result after Ctrl+c
Date: 2017-10-12 10:03:43
Message-ID: 695dda2f-24d3-9487-99b6-24e2d00904f8@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Steps to reproduce -

\\ PG HEAD / PG v10  sources . Connect to psql terminal -  create these
following object

create table tv(n int,n1 char(100));
insert into tv values (generate_series(1,1000000),'aaa');
insert into tv values (generate_series(10000,1000000),'a');
analyze tv;
vacuum tv;

\\1st  query

postgres=# SELECT  *  FROM ( SELECT n   from  tv  where n= (select *
from (select n from tv limit 1) c)) as c  ;
 n
---
 1
(1 row)

\\2nd query
postgres=# SELECT  *  FROM ( SELECT n   from  tv  where n!=ALL (select *
from (select n from tv) c)) as c  ;  [query was taking time so pressed
CTRL-C)
^C2017-10-12 10:54:49.004 BST [9073] ERROR:  canceling statement due to
user request
2017-10-12 10:54:49.004 BST [9073] STATEMENT:  SELECT  *  FROM ( SELECT
n   from  tv  where n!=ALL (select * from (select n from tv) c)) as c  ;
2017-10-12 10:54:49.004 BST [9129] FATAL:  terminating connection due to
administrator command
2017-10-12 10:54:49.004 BST [9129] STATEMENT:  SELECT  *  FROM ( SELECT
n   from  tv  where n!=ALL (select * from (select n from tv) c)) as c  ;
2017-10-12 10:54:49.004 BST [9130] FATAL:  terminating connection due to
administrator command
2017-10-12 10:54:49.004 BST [9130] STATEMENT:  SELECT  *  FROM ( SELECT
n   from  tv  where n!=ALL (select * from (select n from tv) c)) as c  ;
Cancel request sent
2017-10-12 10:54:49.005 BST [9058] LOG:  background worker "parallel
worker" (PID 9129) exited with exit code 1
2017-10-12 10:54:49.005 BST [9058] LOG:  background worker "parallel
worker" (PID 9130) exited with exit code 1
ERROR:  canceling statement due to user request

\\again fired 1st query

postgres=# vacuum ANALYZE tv;
VACUUM
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 ?

--
regards,tushar
EnterpriseDB https://www.enterprisedb.com/
The Enterprise PostgreSQL Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2017-10-12 10:16:10 Re: Query started showing wrong result after Ctrl+c
Previous Message KES 2017-10-12 10:01:06 Re: BUG #14850: Implement optinal additinal parameter for 'justify' date/time function