pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Guillaume Cottenceau <gc@mnc.ch>
Cc: Markus Schaber <schabios@logi-track.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: impossible to update rows specifying columns with NULL
Date: Tue, 01 Mar 2005 13:03:48 -0500
Message-ID: <19062.1109700228@sss.pgh.pa.us> (raw)
In-Reply-To: <877jkrxxoa.fsf@meuh.mnc.ch>
References: <87wtssj2c4.fsf@meuh.mnc.ch>
	<42237EFA.1060502@opencloud.com>
	<87fyzfzqgd.fsf@meuh.mnc.ch>
	<4224528A.3010606@opencloud.com>
	<422460E3.3040100@fastcrypt.com>
	<42247349.8030205@logi-track.com>
	<877jkrxxoa.fsf@meuh.mnc.ch>

Guillaume Cottenceau <gc@mnc.ch> writes:
> Markus Schaber <schabios 'at' logi-track.com> writes:
>> You don't have to do this globally, you can also issue
>> set transform_null_equals to true;
>> as statement so this setting is only for your connection.

> In the doc pointed by Oliver I can read that this NULL != NULL
> behaviour is per SQL standard, so I'm unsure if I should go the
> way of forcing the non standard behaviour..

I don't think it will help you anyway.  That kluge only deals with
the literal syntax "something = NULL" where the NULL is written out
as the keyword NULL.  You appear to be wishing that "something = $n"
would be treated as "something IS NULL" if the parameter $n happened
to have the value NULL, and that most definitely isn't going to happen.

A workaround in recent PG versions is to use "IS DISTINCT FROM", which
is a version of != that works the way you want with nulls.  However this
is guaranteed not to be indexable so I don't know how useful it is in
real-world cases.

In my mind, if you are up against this it suggests that you are misusing
NULL as a "real" data value, which is going to be a big headache given
the SQL sematics for NULL.  You ought to rethink your data
representation.

			regards, tom lane



view thread (11+ messages)  latest in thread

Message-ID: <19062.1109700228@sss.pgh.pa.us>
Permalink:  ../19062.1109700228@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19062.1109700228@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, gc@mnc.ch, schabios@logi-track.com
  Subject: Re: impossible to update rows specifying columns with NULL
  In-Reply-To: <19062.1109700228@sss.pgh.pa.us>
  References: <87wtssj2c4.fsf@meuh.mnc.ch> <42237EFA.1060502@opencloud.com> <87fyzfzqgd.fsf@meuh.mnc.ch> <4224528A.3010606@opencloud.com> <422460E3.3040100@fastcrypt.com> <42247349.8030205@logi-track.com> <877jkrxxoa.fsf@meuh.mnc.ch> <19062.1109700228@sss.pgh.pa.us>

* 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