Re: impossible to update rows specifying columns with NULL

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Guillaume Cottenceau <gc(at)mnc(dot)ch>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: impossible to update rows specifying columns with NULL
Date: 2005-02-28 20:28:42
Message-ID: 42237EFA.1060502@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-02-28 20:31:42 Re: Abandoning PGobject
Previous Message Markus Schaber 2005-02-28 16:31:16 Re: Abandoning PGobject