pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Raphael Bauduin <rblists@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: difference between EXCEPT and NOT IN?
Date: Tue, 1 Apr 2008 09:04:22 -0700 (PDT)
Message-ID: <20080401085733.F16796@megazone.bigpanda.com> (raw)
In-Reply-To: <f5227160804010850q74063e22t644ea4274c67730d@mail.gmail.com>
References: <f5227160804010850q74063e22t644ea4274c67730d@mail.gmail.com>

On Tue, 1 Apr 2008, Raphael Bauduin wrote:

> The 2 following statements don't give the same result. I expected the
> second ti give the exact same result as the first one.

If any entree_id can be NULL they aren't defined to give the same result.

EXCEPT is defined in terms of duplicates based on distinctness, and for
example (1 is distinct from 1) is false, (1 is distinct from NULL) is true
and (NULL is distinct from NULL) if false.

NOT IN is defined in terms of equality, and for example, (1=1) is true,
(1=NULL) is unknown and (NULL=NULL) is unknown.



view thread (3+ messages)  latest in thread

Message-ID: <20080401085733.F16796@megazone.bigpanda.com>
Permalink:  ../20080401085733.F16796@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20080401085733.F16796@megazone.bigpanda.com

 · 

reply

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: sszabo@megazone.bigpanda.com, rblists@gmail.com
  Subject: Re: difference between EXCEPT and NOT IN?
  In-Reply-To: <20080401085733.F16796@megazone.bigpanda.com>

* 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