pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: Oliver Jowett <oliver@opencloud.com>
Cc: 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 07:32:35 -0500
Message-ID: <422460E3.3040100@fastcrypt.com> (raw)
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>

Well, if you are really intent on using this you can set
transform_null_equals=true in postgresql.conf

Dave

Oliver Jowett wrote:

> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if 
> your
>      joining column's datatypes do not match
>
>

-- 
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561




view thread (11+ messages)  latest in thread

Message-ID: <422460E3.3040100@fastcrypt.com>
Permalink:  ../422460E3.3040100@fastcrypt.com/
Also on:    postgresql.org/message-id/422460E3.3040100@fastcrypt.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: pg@fastcrypt.com, oliver@opencloud.com, gc@mnc.ch
  Subject: Re: impossible to update rows specifying columns with NULL
  In-Reply-To: <422460E3.3040100@fastcrypt.com>
  References: <87wtssj2c4.fsf@meuh.mnc.ch> <42237EFA.1060502@opencloud.com> <87fyzfzqgd.fsf@meuh.mnc.ch> <4224528A.3010606@opencloud.com> <422460E3.3040100@fastcrypt.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