Re: impossible to update rows specifying columns with NULL - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: impossible to update rows specifying columns with NULL
Date
Msg-id 42237EFA.1060502@opencloud.com
Whole thread Raw
In response to impossible to update rows specifying columns with NULL value?  (Guillaume Cottenceau <gc@mnc.ch>)
Responses Re: impossible to update rows specifying columns with NULL value?  (Guillaume Cottenceau <gc@mnc.ch>)
List pgsql-jdbc
Guillaume Cottenceau wrote:

> The problem is when trying to UPDATE (changing values of other
> columns): my PreparedStatement uses "... WHERE column = ?" to
> specify the NULL value for the said column,

You can't do that and get the results you expect. "column = NULL" is
never true (because "NULL = NULL" is false). You should use IS NULL to
match a NULL value.

See http://www.postgresql.org/docs/8.0/static/functions-comparison.html
for details.

-O

pgsql-jdbc by date:

Previous
From: Guillaume Cottenceau
Date:
Subject: impossible to update rows specifying columns with NULL value?
Next
From: Oliver Jowett
Date:
Subject: Re: Abandoning PGobject