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: Tue, 01 Mar 2005 09:28:42 +1300
Message-ID: <42237EFA.1060502@opencloud.com> (raw)
In-Reply-To: <87wtssj2c4.fsf@meuh.mnc.ch>
References: <87wtssj2c4.fsf@meuh.mnc.ch>

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



view thread (11+ messages)  latest in thread

Message-ID: <42237EFA.1060502@opencloud.com>
Permalink:  ../42237EFA.1060502@opencloud.com/
Also on:    postgresql.org/message-id/42237EFA.1060502@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: <42237EFA.1060502@opencloud.com>
  References: <87wtssj2c4.fsf@meuh.mnc.ch> <42237EFA.1060502@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