Re: wired behaviour

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Shane Ambler <pgsql(at)Sheeky(dot)Biz>
Cc: Lutz Steinborn <l(dot)steinborn(at)4c-ag(dot)de>, pgsql-sql(at)postgresql(dot)org
Subject: Re: wired behaviour
Date: 2008-12-01 17:18:50
Message-ID: 49341C7A.5070000@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Vignesh Raaj 2008-12-01 18:39:23 Reg: Nested query
Previous Message John Dizaro 2008-12-01 16:25:23 how to update 400 000 register not at the same time?