pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Phill Kenoyer <pgsql@c0de.net>
To: Bob Smith, Hammett & Edison, Inc. <bsmith@h-e.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Odd behavior with NULL value
Date: Thu, 20 Dec 2001 17:22:35 -0800
Message-ID: <20011221012235.GW19766@c0de.net> (raw)
In-Reply-To: <000001411043091739073@h-e.com>
References: <000001411043091739073@h-e.com>

I think that this page will explain it all:
http://www.postgresql.org/idocs/index.php?functions-comparison.html

|On 011220 17:05
|Bob Smith, Hammett & Edison, Inc. (bsmith@h-e.com) wrote the following...
|
|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)
-- 
Reason: Typo in the code
                                               _   |       _           
                                              (_()(|('.|)('||.|()|`|(



view thread (8+ messages)  latest in thread

Message-ID: <20011221012235.GW19766@c0de.net>
Permalink:  ../20011221012235.GW19766@c0de.net/
Also on:    postgresql.org/message-id/20011221012235.GW19766@c0de.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: pgsql@c0de.net, bsmith@h-e.com
  Subject: Re: Odd behavior with NULL value
  In-Reply-To: <20011221012235.GW19766@c0de.net>
  References: <000001411043091739073@h-e.com> <20011221012235.GW19766@c0de.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox