Re: - Mailing list pgsql-bugs

From Peter Eisentraut
Subject Re:
Date
Msg-id Pine.LNX.4.30.0203111138320.690-100000@peter.localdomain
Whole thread Raw
In response to ...  (Bhuvan A <bhuvansql@yahoo.com>)
List 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@gmx.net

pgsql-bugs by date:

Previous
From: Yury Bokhoncovich
Date:
Subject: Re:
Next
From: Stephan Szabo
Date:
Subject: Re: