From: Michael Fuhr <mike@fuhr.org>
To: Phillip Smith <phillip.smith@weatherbeeta.com.au>
Cc: pgsql-sql@postgresql.org
Subject: Re: Differentiate Between Zero-Length String and NULL Column Values
Date: Mon, 29 Jan 2007 22:45:43 -0700
Message-ID: <20070130054543.GA98994@winnie.fuhr.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:
> The second row (401600) is what I'm interested in for this particular
> problem. The problem is when I try and add a WHERE clause:
> SELECT * FROM tmpstk WHERE ean = '';
> SELECT * FROM tmpstk WHERE TRIM(ean) = '';
> SELECT * FROM tmpstk WHERE ean = NULL;
> None of the above queries return any rows.
Checking for equality against NULL won't work unless you have
transform_null_equals set, which you shouldn't. Use IS NULL instead:
SELECT * FROM tmpstk WHERE ean IS NULL;
--
Michael Fuhr
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: mike@fuhr.org, phillip.smith@weatherbeeta.com.au
Subject: Re: Differentiate Between Zero-Length String and NULL Column Values
In-Reply-To: <20070130054543.GA98994@winnie.fuhr.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