From: | "Bart Degryse" <Bart(dot)Degryse(at)indicator(dot)be> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Differentiate Between Zero-Length String and NULLColumn Values |
Date: | 2007-01-30 13:38:07 |
Message-ID: | 45BF584F.A3DD.0030.0@indicator.be |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Andrew, I think you're wrong stating that Oracle would interpret NULL and empty string as equal.
The Oracle databases I use (8, 9 and 10) certainly make a distiction between both values.
Maybe earlier versions did so, that I don't know.
>>> Andrew Sullivan <ajs(at)crankycanuck(dot)ca> 2007-01-30 14:13 >>>
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(at)crankycanuck(dot)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
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2007-01-30 14:23:32 | Re: Differentiate Between Zero-Length String and NULLColumn Values |
Previous Message | Andrew Sullivan | 2007-01-30 13:13:34 | Re: Differentiate Between Zero-Length String and NULL Column Values |