Re: Nulls get converted to 0 problem - Mailing list pgsql-general

From Dmitry Tkach
Subject Re: Nulls get converted to 0 problem
Date
Msg-id 3EE0AAE5.8090808@openratings.com
Whole thread Raw
In response to Re: Nulls get converted to 0 problem  (Jon Earle <je_pgsql@kronos.honk.org>)
List pgsql-general
>
>
>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?
>
>
World of difference :-)
An intereger value of 0 is *certainly* "somethign", as well as an empty
string.

>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?
>
Not at all. An empty string in C is a valid pointer to a memory
location, that contains a 0, and NULL is a pointer to a memory location
that does not exist.
They are not equivalent at all.

Dima




pgsql-general by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: EXTERN JOIN with WHEN query
Next
From: Andrew Sullivan
Date:
Subject: Re: implicit type conversions