Weirdness with "not in" query

From: greigwise <greigwise(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Weirdness with "not in" query
Date: 2017-06-08 15:27:52
Message-ID: 1496935672806-5965573.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

So, I'm using postgres version 9.6.3 on a mac and the results to this series
of queries seems very strange to me:

db# select count(*) from table1 where id in
(1706302,1772130,1745499,1704077);
count
-------
4
(1 row)

db# select count(*) from table2 where table1_id in
(1706302,1772130,1745499,1704077);
count
-------
0
(1 row)

db# select count(*) from table1 where id not in (select table1_id from
table2);
count
-------
0
(1 row)

I would expect the "not in" query to return a result of at least 4. Am I
totally misunderstanding how this should work (I really don't think so) or
is something wrong?

Thanks,
Greig Wise

--
View this message in context: http://www.postgresql-archive.org/Weirdness-with-not-in-query-tp5965573.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2017-06-08 15:33:13 Re: Weirdness with "not in" query
Previous Message Adrian Klaver 2017-06-08 15:23:13 Re: ERROR: unexpected chunk number 0 (expected 1) for toast value 76753264 in pg_toast_10920100