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

On Tue, Apr 1, 2008 at 6:04 PM, Stephan Szabo
<sszabo@megazone.bigpanda.com> wrote:
> 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.
>

My problem came from 2 entries in the table postes that had an entree_id NULL

Thanks for your fast answer, it has helped me spot the problem!

Raph

-- 
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org



view thread (3+ messages)

Message-ID: <f5227160804010943m723de307g3aa51adeb17419a2@mail.gmail.com>
Permalink:  ../f5227160804010943m723de307g3aa51adeb17419a2@mail.gmail.com/
Also on:    postgresql.org/message-id/f5227160804010943m723de307g3aa51adeb17419a2@mail.gmail.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: rblists@gmail.com, sszabo@megazone.bigpanda.com
  Subject: Re: difference between EXCEPT and NOT IN?
  In-Reply-To: <f5227160804010943m723de307g3aa51adeb17419a2@mail.gmail.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