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 4224528A.3010606@opencloud.com
Whole thread Raw
In response to Re: impossible to update rows specifying columns with NULL value?  (Guillaume Cottenceau <gc@mnc.ch>)
Responses Re: impossible to update rows specifying columns with NULL
List pgsql-jdbc
Guillaume Cottenceau wrote:
> 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.

Unfortunately, that's just the way that SQL NULLs work..

> With such situation, we
> can't use the same prepared-statement to match NULL and non-NULL
> values then, or I missed something?

You are correct.

-O

pgsql-jdbc by date:

Previous
From: Guillaume Cottenceau
Date:
Subject: Re: impossible to update rows specifying columns with NULL value?
Next
From: "sandrigo.lezcano@gmail.com"
Date:
Subject: string de conexao em JAVA