Re: Trouble in SELECT query - Mailing list pgsql-bugs

From Peter Eisentraut
Subject Re: Trouble in SELECT query
Date
Msg-id Pine.LNX.4.30.0109101609270.680-100000@peter.localdomain
Whole thread Raw
In response to Trouble in SELECT query  ("Serg Matskov" <da6127@cad.ntu-kpi.kiev.ua>)
List pgsql-bugs
Serg Matskov writes:

> I have a PostgreSQL 7.1. When I start query like "SELECT * FROM table1
> WHERE field1 = NULL;" it working OK, but query like "SELECT * FROM
> table1 WHERE field1 <> NULL" returns the void result. Field "field1"
> has type DATE. "... field1 IS NULL", "... field1 IS NOT NULL", "...
> field1 <> 0" also working correctly. "... field1 = 0" also not
> working.

'field <> NULL' is always false, so it's not surprising that no rows are
returned.  'field = NULL' should also be false, but PostgreSQL treats it
as 'field IS NULL' to allow broken clients to work.  See also
<http://www.de.postgresql.org/users-lounge/docs/7.1/postgres/functions-comparison.html>.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter

pgsql-bugs by date:

Previous
From: "Valery Kocubinsky"
Date:
Subject:
Next
From: Lamar Owen
Date:
Subject: Re: [HACKERS] Build problem with CVS version