pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Sullivan <ajs@crankycanuck.ca>
To: pgsql-sql@postgresql.org
Subject: Re: Differentiate Between Zero-Length String and NULL Column Values
Date: Tue, 30 Jan 2007 08:13:34 -0500
Message-ID: <20070130131334.GD31676@phlogiston.dyndns.org> (raw)
In-Reply-To: <016d01c74430$043b1b90$9b0014ac@wbaus090>
References: <016d01c74430$043b1b90$9b0014ac@wbaus090>

On Tue, Jan 30, 2007 at 04:32:22PM +1100, Phillip Smith wrote:
> SHAMPOO","EQUEST","401600","0.00","0.00","0.00","0.00","10.00",""
                                                                 ^^
> 	SELECT * FROM tmpstk WHERE ean = NULL;
                                         ^^^^

Along with what Michael Fuhr said in his post about equality and
NULL, Postgres doesn't treat the empty string and NULL as equivalent
(because they're not).  Only Oracle has that dodgy interpretation of
SQL, as far as I know.  If you want to use the empty string, you need 

	WHERE ean = ''

If you want instead ean to be NULL, use the traditional \N to signify
NULL on your way in, or define null some other way.

A

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
Users never remark, "Wow, this software may be buggy and hard 
to use, but at least there is a lot of code underneath."
		--Damien Katz



view thread (15+ messages)  latest in thread

Message-ID: <20070130131334.GD31676@phlogiston.dyndns.org>
Permalink:  ../20070130131334.GD31676@phlogiston.dyndns.org/
Also on:    postgresql.org/message-id/20070130131334.GD31676@phlogiston.dyndns.org

 · 

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: ajs@crankycanuck.ca
  Subject: Re: Differentiate Between Zero-Length String and NULL Column Values
  In-Reply-To: <20070130131334.GD31676@phlogiston.dyndns.org>

* 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