Thread: Trouble in SELECT query
I have a PostgreSQL 7.1. When I start query like "SELECT * FROM table1 WHER= E field1 =3D NULL;" it working OK, but query like "SELECT * FROM table1 WHE= RE field1 <> NULL" returns the void result. Field "field1" has type DATE. "= ... field1 IS NULL", "... field1 IS NOT NULL", "... field1 <> 0" also worki= ng correctly. "... field1 =3D 0" also not working. With best regards, Serg Matskov.
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