Re: NULL vs. Empty String - Mailing list pgsql-general

From Oliver Elphick
Subject Re: NULL vs. Empty String
Date
Msg-id 200103140656.f2E6unG27646@linda.lfix.co.uk
Whole thread Raw
In response to NULL vs. Empty String  (David Wheeler <david@wheeler.net>)
Responses Re: NULL vs. Empty String
List 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.Elphick@lfix.co.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



pgsql-general by date:

Previous
From: "Oliver Elphick"
Date:
Subject: Re: Fw: Fw: Please Help
Next
From: "keith"
Date:
Subject: Fw: Missing Shared Libraries