Re: impossible to update rows specifying columns with NULL value?

From: Guillaume Cottenceau <gc(at)mnc(dot)ch>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: impossible to update rows specifying columns with NULL value?
Date: 2005-03-01 09:05:22
Message-ID: 87fyzfzqgd.fsf@meuh.mnc.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Oliver Jowett <oliver 'at' opencloud.com> writes:

> 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.

It's a pity. This would be very helpful. With such situation, we
can't use the same prepared-statement to match NULL and non-NULL
values then, or I missed something?

--
Guillaume Cottenceau

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-03-01 11:31:22 Re: impossible to update rows specifying columns with NULL
Previous Message Stéphane RIFF 2005-03-01 07:56:49 Connection pool problem