In the question 
<http://stackoverflow.com/questions/35891605/why-do-i-receive-an-unexpected-result>
David Paton asks about a query like this:

  create table a(id integer primary key);
  create table b(id integer primary key);
  insert into a values (1), (2);
  insert into b values (1);

  select id from a where id not in (select a.id from b);

which outputs one result (2), although the expected result would be
empty.

The EXPLAIN outputs shows that the database behaves as if the subquery
were referring to b.id, and in fact making that change in the query
results in exactly the same EXPLAIN output.


Regards,
Clemens

Reply via email to