pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Scott Whitney <swhitney@journyx.com>
To: pgsql-admin@postgresql.org
Subject: Re: Strange query problem...
Date: Wed, 28 Jan 2009 12:05:20 -0600
Message-ID: <49804A00.EE98.0025.0@wicourts.gov> (raw)
In-Reply-To: <20090128174824.B4C457E4165@mail.int.journyx.com>
References: <20090128174824.B4C457E4165@mail.int.journyx.com>

>>> "Scott Whitney" <swhitney@journyx.com> wrote: 
> Um. How is this possible?
 
> mydb=# select * from time_recs where id_time_rec not in (select
> id_time_rec from punch_time_recs);
 
> (0 rows)
 
>                        Table "public.punch_time_recs"
>       Column       |          Type          |           Modifiers    
     
>
-------------------+------------------------+-------------------------------
 
>  id_time_rec       | character varying(38)  | 
 
The column in punch_time_recs is null capable.  Try using NOT EXISTS.
 
The SQL spec requires the NOT IN to be the equivalent of a "not
equals" test for all entries, and you can't say that any given value
is not equal to NULL, since NULL can mean that there is a value but
you don't know it.  The semantics of NOT EXISTS are subtly different
here -- it means there aren't any rows known to have the value.
 
-Kevin



view thread (8+ messages)  latest in thread

Message-ID: <49804A00.EE98.0025.0@wicourts.gov>
Permalink:  ../49804A00.EE98.0025.0@wicourts.gov/
Also on:    postgresql.org/message-id/49804A00.EE98.0025.0@wicourts.gov

 · 

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-admin@postgresql.org
  Cc: Kevin.Grittner@wicourts.gov, swhitney@journyx.com
  Subject: Re: Strange query problem...
  In-Reply-To: <49804A00.EE98.0025.0@wicourts.gov>

* 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