Re: NULL vs. Empty String

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: David Wheeler <david(at)wheeler(dot)net>
Cc: pgsql-general(at)postgresql(dot)org, dbi-users(at)perl(dot)org
Subject: Re: NULL vs. Empty String
Date: 2001-03-14 06:56:49
Message-ID: 200103140656.f2E6unG27646@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

David Wheeler wrote:
>Is there a way to get Posgres to assume that a '' insert should be a NULL
>insert? And if not, does anyone know of a way to get mod_perl to make that
>assumption instead?

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).

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Let your light so shine before men, that they may see
your good works, and glorify your Father which is in
heaven." Matthew 5:16

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fabien COUTANT 2001-03-14 08:26:08 [Q] post-crash behaviour
Previous Message Oliver Elphick 2001-03-14 06:56:32 Re: Fw: Fw: Please Help