Odd behavior with NULL value - Mailing list pgsql-admin

From bsmith@h-e.com (Bob Smith, Hammett & Edison, Inc.)
Subject Odd behavior with NULL value
Date
Msg-id 000001411043091739073@h-e.com
Whole thread Raw
Responses Re: Odd behavior with NULL value  (Bruno Wolff III <bruno@[66.92.219.49]>)
Re: Odd behavior with NULL value  (Phill Kenoyer <pgsql@c0de.net>)
Re: Odd behavior with NULL value  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-admin
See example below of using NULL values with type DATE.  It behaves
strangely in expressions, "(x <> null)" gives an entirely different
result than "not(x = null)".  Is this intended behavior, if so, why?
If not, is this a bug?

On a related note, does anyone know if 'current' works with DATE?  With
TIMESTAMP it always evaluates to the time as of the retrieval of the
value, not as of the insertion, but for DATE it looks like it gets
evaluated at insertion (I can't tell for sure from my test db for another
8 hours or so, I could just roll the date forward on the server, but I'd
like to keep my job...)

Thanks to anyone who can shed some light on this!

rsj=> \d test
          Table "test"
 Attribute |  Type   | Modifier
-----------+---------+----------
 key       | integer |
 date      | date    |

rsj=> select * from test;
 key |    date
-----+------------
   1 | 2001-12-20
   2 | 2001-12-20
   3 |
(3 rows)

rsj=> select * from test where date = null;
 key | date
-----+------
   3 |
(1 row)

rsj=> select * from test where date <> null;
 key | date
-----+------
(0 rows)

rsj=> select * from test where not(date = null);
 key |    date
-----+------------
   1 | 2001-12-20
   2 | 2001-12-20
(2 rows)

rsj=>


   |\      _,,,---,,_        Bob Smith
   /,`.-'`'    -.  ;-;;,_    Hammett & Edison, Inc.
  |,4-  ) )-,_. ,\ (  `'-'   bsmith@h-e.com
 '---''(_/--'  `-'\_)

pgsql-admin by date:

Previous
From: "Christian"
Date:
Subject: Re: Data partitioning
Next
From: Bruno Wolff III
Date:
Subject: Re: Odd behavior with NULL value