Re: NULL vs. Empty String

From: David Wheeler <david(at)wheeler(dot)net>
To: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org, dbi-users(at)perl(dot)org
Subject: Re: NULL vs. Empty String
Date: 2001-03-14 16:55:00
Message-ID: Pine.LNX.4.21.0103140851320.12837-100000@theory
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 14 Mar 2001, Oliver Elphick wrote:

> You could write a rule for each table/column that would substitute
> NULL for ''.
>
> However, the concept is all wrong. NULL means "I don't know what
> this value is". '' means "I know that this value is an empty string".
> Furthermore, having NULLs in columns means you have to be careful
> to use ternary logic for every condition (because NULL=x is neither
> true nor false).

And On Wed, 14 Mar 2001, Steven Lembark wrote:

> Postgress is doing what you want it to -- see anything CJ Date
> has written in the last 20 years. you are better off inserting
> a default value of '' than NULL -- otherwise you have no idea
> what joins mean.

I completely agree with you two that PostgreSQL does The Right Thing (TM)
vs. what Oracle does. Thus, perhaps I should shift the focus of my queries
to the mod_perl list, since I think it makes sense that empty form fields
submitted from a web page should show up in Perl as undefined (and
therefore will be inserted into Postgres as NULL) rather than as empty
strings.

Thanks for the feedback.

David

In response to

Browse pgsql-general by date

  From Date Subject
Next Message J.H.M. Dassen Ray 2001-03-14 17:07:45 Re: Re: compilation error <segunda parte>
Previous Message Renaud Tthonnart 2001-03-14 16:53:54 MetaData