From: Tom Lane <tgl@sss.pgh.pa.us>
To: Warren Little <wlittle@securitylending.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Why do the two queries below return different results?
Date: Sun, 20 Jul 2003 00:54:26 -0400
Message-ID: <20000.1058676866@sss.pgh.pa.us> (raw)
In-Reply-To: <1058388773.5345.8.camel@localhost.localdomain>
References: <1058388773.5345.8.camel@localhost.localdomain>
Warren Little <wlittle@securitylending.com> writes:
> Look at the following two queries.
> ...
> and not exists (select pid from casecombo where casepid = secondpid)
> ...
> and casepid not in (select secondpid from casecombo)
> The second query is broken and I don't understand why.
I'll bet there are some NULL values for secondpid in casecombo.
The behavior of NOT IN with NULLs is fairly unintuitive :-(
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, wlittle@securitylending.com
Subject: Re: Why do the two queries below return different results?
In-Reply-To: <20000.1058676866@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox