Re: Nulls get converted to 0 problem

Поиск
Список
Период
Сортировка
От Andre Truter
Тема Re: Nulls get converted to 0 problem
Дата
Msg-id 1054914889.17932.178.camel@tux.atio.co.za
обсуждение исходный текст
Ответ на Re: Nulls get converted to 0 problem  (Jon Earle <je_pgsql@kronos.honk.org>)
Список pgsql-general
On Thu, 2003-06-05 at 15:39, Jon Earle wrote:
> On Wed, 4 Jun 2003 terry@ashtonwoodshomes.com wrote:
>
> > Oracle *incorrectly* interprets blank (empty) strings as NULL.  They are NOT
> > the same.  A string of zero characters is a string nonetheless.  A NULL is
> > "the absence of value", which equals nothing (theoretically not even another
> > NULL).
>
> If you're testing a value, you're testing to see if there's something in
> there or not - what difference does it make if the variable contains 0, ""
> or NULL?
>
> Why not adhere to the practices inherent (and thus anticipated by
> developers) in other languages (C comes to mind) where 0, NULL and "" are
> equivalent?
>
> Cheers!

No! For me it is very important that NULL does not equal 0 or "",
because we have a database where a value of 0 means 0 and a NULL means
that the data normally stored there is not applicable for that record.
We calculate averages on the fields, and we don't want 'not applicable'
values to affect the average.

In any case, this is actually in line with languages like C, because
NULL means that no memory has been assigned to a variable, it does not
mean that the value stored in that variable is 0, or even "".

NULL, 0 and "" are definitely not the same thing in C.  If you see them
as the same, you are just looking for segmentation faults. :-)

In any case, NULL should not equal 0, as 0 is a value (between -1 and
1), while NULL is nothing, you cannot compare it to another value.

Is NULL smaller or larger than 1?

--
Andre Truter
Software Engineer
Registered Linux user #185282
ICQ #40935899  AIM: trusoftzaf
http://www.trusoft.za.net

<------------------------------------------------->
< The box said: Requires Windows 95 or better...  >
< So I installed Linux                            >
<------------------------------------------------->


Disclaimer and Confidentiality Warning

This message is intended for the addressee only. If you are not the intended recipient of this message, you are
notifiedthat any distribution, use of or copying of this communication is strictly prohibited. If you have received the
communicationin error, please notify the sender immediately. The views and opinions expressed in this message are those
ofthe individual sender of this message and do not necessarily represent the views and opinions of ATIO. Consequently,
ATIOdoes not accept responsibility for such views and opinions and this message should not be read as representing the
viewsand opinions of ATIO without subsequent written confirmation. Each page attached hereto must also be read in
conjunctionwith this disclaimer. 


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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: Bug in metaphone (contrib/fuzzystrmatch)
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: Nulls get converted to 0 problem