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



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to