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

Re:

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bhuvan A <bhuvansql(at)yahoo(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re:
Date: 2002-03-11 16:46:31
Message-ID: Pine.LNX.4.30.0203111138320.690-100000@peter.localdomain (view raw or flat)
Thread:
Lists: pgsql-bugs
Bhuvan A writes:

> > If you compare a NULL with anything you don't get a true value whether
> > you're comparing with =, !=, <, >, etc...  That's how it's defined to
> > behave.
>
> where did you get this definition of behaviour!? is it applicable only to
> postgres or ..?  its quite strange yaar!

It's how the SQL standard defines it.  If other database software claims
to comply to SQL it should also behave that way.  (Before you complain
about the SQL standard, its definition was adopted from the common
mathematical notion of three-valued Boolean logic.)

If you want

   a <> b

to return true if one of a and b is NULL and the other is not NULL then
you will have to do a bit more work.  For example,

   (a <> b) or (a is null and b is not null) or (a is not null and b is null)

-- 
Peter Eisentraut   peter_e(at)gmx(dot)net


In response to

  • at 2002-03-11 10:26:50 from Bhuvan A

pgsql-bugs by date

Next:From: Stephan SzaboDate: 2002-03-11 17:02:09
Subject: Re:
Previous:From: Yury BokhoncovichDate: 2002-03-11 14:33:30
Subject: Re:

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