Re: wired behaviour

Поиск
Список
Период
Сортировка
От Steve Crawford
Тема Re: wired behaviour
Дата
Msg-id 49341C7A.5070000@pinpointresearch.com
обсуждение исходный текст
Ответ на Re: wired behaviour  (Shane Ambler <pgsql@Sheeky.Biz>)
Список pgsql-sql
Shane Ambler wrote:
> Lutz Steinborn wrote:
>> Jepp, thats it.
>> I've supposed this but can't believe it. So NULL is something out of 
>> this
>> dimension :-)
>>
>>
>
> NULL refers to an unknown value - it cannot be said to equal or not 
> equal anything other than NULL ...
>
Not exactly. Null does not equal null. The "translation" being does 
some-unknown-value equal some-unknown-value? Answer: unknown.
If you want to determine if something is null you must use "is null".

select null = null;
null

select null is null;
true

If you want to treat nulls as a defined known value, use the coalesce 
function:
select coalesce(my_column, 'a null value')....;
will return the string 'a null value' whenever my_column is null.

Cheers,
Steve



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

Предыдущее
От: "John Dizaro"
Дата:
Сообщение: how to update 400 000 register not at the same time?
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] Reg: Nested query