Received: from h-e.com (wan-vc8fa2d.ston.biz.mindspring.com [216.135.168.77]) by postgresql.org (8.11.3/8.11.4) with SMTP id fBL0P9m55240 for ; Thu, 20 Dec 2001 19:25:09 -0500 (EST) (envelope-from bsmith@h-e.com) Subject: Odd behavior with NULL value Message-Id: <000001411043091739073@h-e.com> From: bsmith@h-e.com (Bob Smith, Hammett & Edison, Inc.) Date: Thu, 20 Dec 2001 16:24:33 -0800 Organization: Hammett & Edison, Inc. X-Mailer: CommuniGate 3.2.1 To: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit X-Archive-Number: 200112/144 X-Sequence-Number: 2867 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 '---''(_/--' `-'\_)