Re: Trouble in SELECT query

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Serg Matskov <da6127(at)cad(dot)ntu-kpi(dot)kiev(dot)ua>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Trouble in SELECT query
Date: 2001-09-10 14:14:31
Message-ID: Pine.LNX.4.30.0109101609270.680-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Lamar Owen 2001-09-10 15:17:28 Re: [HACKERS] Build problem with CVS version
Previous Message Valery Kocubinsky 2001-09-10 12:24:13