Re: null vs empty string

From: "Rob Richardson" <Rob(dot)Richardson(at)rad-con(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: null vs empty string
Date: 2010-06-30 12:40:22
Message-ID: 04A6DB42D2BA534FAC77B90562A6A03D01465CFF@server.rad-con.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


The big thing to keep in mind when working with nulls is that NULL does
not mean that there is nothing in the field. NULL means that the
database does not know what is in the field. So, the only way to base a
selection on whether or not a field is NULL is to use the ISNULL()
function. Also, no comparison with NULL will ever return true. A query
like "SELECT * FROM SomeTable WHERE NULL = NULL" will return no records.
Since the database does not know what is in a NULL-valued field, it
cannot be confident that one such field is equal to another, and since
it's not confident, it has to return false.

RobR

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Thom Brown 2010-06-30 12:41:45 Re: null vs empty string
Previous Message Kent Thomas 2010-06-30 12:21:54 null vs empty string