Re: Nulls get converted to 0 problem

From: Jon Earle <je_pgsql(at)kronos(dot)honk(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Nulls get converted to 0 problem
Date: 2003-06-06 15:21:58
Message-ID: Pine.LNX.4.55.0306061118420.19934@kronos.honk.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 6 Jun 2003, Mattias Kregert wrote:

> 1. Imagine a table with dates and weather conditions. How would you
> differ between "zero degrees" and "no data entered yet"? You would
> have to add a column (degrees_valid boolean). Having the NULL value
> makes things much easier.
>
> 2. In OO languages (c++, java, and so on), a null pointer is very
> different from a pointer to an object - even if that object contains
> the value 0 (zero) or an empty string (""). The "practices" you refer
> to does not apply/is not inherent in all languages. NULL means that
> the variable points to nothing at all. "" means that there is some
> address/space allocated.
> Example:
> String mystring = NULL; // pointer mystring points to nothing (no
> allocation)
> String mystring = new String(""); // pointer mystring points to a
> memory location, which currently holds the empty data "".

<click!>

Thank you Mattias, the differences (and similarities) are now clear.

Cheers!
Jon

--
Jon Earle

SAVE FARSCAPE http://www.savefarscape.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Samuel Tardieu 2003-06-06 15:31:40 Re: Nulls get converted to 0 problem
Previous Message Rory Campbell-Lange 2003-06-06 15:20:01 Return Record