Re: Select .... where id not in (....) returns 0 incorrectly - Mailing list pgsql-general

From Jeremy Smith
Subject Re: Select .... where id not in (....) returns 0 incorrectly
Date
Msg-id CAM8SmLWx8b4kZN64wR2iYtQEKuSmYEXS7E42c+D5OPxdyWx9iQ@mail.gmail.com
Whole thread Raw
In response to Re: Select .... where id not in (....) returns 0 incorrectly  (Ravi Krishna <srkrishna@vivaldi.net>)
Responses Re: Select .... where id not in (....) returns 0 incorrectly  ("J. Roeleveld" <joost@antarean.org>)
List pgsql-general


Doesn't this usually happen if q.id contains NULL.  That is as per ANSI
standard.


Yes, there's a good description of this here:

It would be better to use NOT EXISTS:
select count(*) from snapshotlist where NOT EXISTS (SELECT FROM q WHERE q.id = snapshotlist.id);


-Jeremy

pgsql-general by date:

Previous
From: Ravi Krishna
Date:
Subject: Re: Select .... where id not in (....) returns 0 incorrectly
Next
From: "J. Roeleveld"
Date:
Subject: Re: Select .... where id not in (....) returns 0 incorrectly