Re: Differentiate Between Zero-Length String and NULL Column Values

Поиск
Список
Период
Сортировка
От Andrew Sullivan
Тема Re: Differentiate Between Zero-Length String and NULL Column Values
Дата
Msg-id 20070130131334.GD31676@phlogiston.dyndns.org
обсуждение исходный текст
Ответ на Differentiate Between Zero-Length String and NULL Column Values  ("Phillip Smith" <phillip.smith@weatherbeeta.com.au>)
Ответы Re: Differentiate Between Zero-Length String and NULLColumn Values
Список pgsql-sql
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


В списке pgsql-sql по дате отправления:

Предыдущее
От: Niklas Bergius
Дата:
Сообщение: Arrays, multidimensional ANY (v 8.2)
Следующее
От: "Bart Degryse"
Дата:
Сообщение: Re: Differentiate Between Zero-Length String and NULLColumn Values