pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Stosberg <mark@summersault.com>
To: pgsql-sql@postgresql.org
Subject: behavior of ' = NULL' vs. MySQL vs. Standards
Date: Wed, 06 Jun 2001 20:00:45 -0500
Message-ID: <3B1ED23A.984C3159@summersault.com> (raw)


Hello,

I'm a long time Postgres user who uses MySQL when I have to. I recently
ran into an issue with MySQL where this construct didn't do what I expect:

WHERE date_column = NULL

I expected it to work like "date_column IS NULL" like it does it
Postgres 7.0.2, but instead it returned an empty result set. 

After conversing with some folks on the MySQL list, it was mentioned that:

 * "NULL is *NOT* a value. It's an absence of a value, and doing *any*
comparisons with NULL is invalid (the result must always be NULL, even
if you say "foo = NULL")." 

 * Postgres handling is non-standard (even if it's intuitive.) 

My questions then are: 1.) What IS the standard for handling NULLs? and
then 2.) If Postgres handling is different than the standard, what's the
reason? 

To me, having " = NULL" be the same as " IS NULL" is intuitive and thus
useful, but I also like appeal of using standards when possible. :) 

Thanks!

  -mark

http://mark.stosberg.com/



view thread (17+ messages)  latest in thread

Message-ID: <3B1ED23A.984C3159@summersault.com>
Permalink:  ../3B1ED23A.984C3159@summersault.com/
Also on:    postgresql.org/message-id/3B1ED23A.984C3159@summersault.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: mark@summersault.com
  Subject: Re: behavior of ' = NULL' vs. MySQL vs. Standards
  In-Reply-To: <3B1ED23A.984C3159@summersault.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