Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2005-02-28 20:31:42
Subject: Re: Abandoning PGobject
Previous:From: Markus SchaberDate: 2005-02-28 16:31:16
Subject: Re: Abandoning PGobject

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group