pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Guillaume Cottenceau <gc@mnc.ch>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: impossible to update rows specifying columns with NULL
Date: Wed, 02 Mar 2005 00:31:22 +1300
Message-ID: <4224528A.3010606@opencloud.com> (raw)
In-Reply-To: <87fyzfzqgd.fsf@meuh.mnc.ch>
References: <87wtssj2c4.fsf@meuh.mnc.ch>
	<42237EFA.1060502@opencloud.com>
	<87fyzfzqgd.fsf@meuh.mnc.ch>

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



view thread (11+ messages)  latest in thread

Message-ID: <4224528A.3010606@opencloud.com>
Permalink:  ../4224528A.3010606@opencloud.com/
Also on:    postgresql.org/message-id/4224528A.3010606@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, gc@mnc.ch
  Subject: Re: impossible to update rows specifying columns with NULL
  In-Reply-To: <4224528A.3010606@opencloud.com>
  References: <87wtssj2c4.fsf@meuh.mnc.ch> <42237EFA.1060502@opencloud.com> <87fyzfzqgd.fsf@meuh.mnc.ch> <4224528A.3010606@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox