Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

Next:From: Thom BrownDate: 2010-06-30 12:41:45
Subject: Re: null vs empty string
Previous:From: Kent ThomasDate: 2010-06-30 12:21:54
Subject: null vs empty string

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group