X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E361A565B7 for ; Tue, 1 Mar 2005 18:04:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34195-05 for ; Tue, 1 Mar 2005 18:03:54 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E6C80565BE for ; Tue, 1 Mar 2005 18:03:53 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j21I3nVu019063; Tue, 1 Mar 2005 13:03:49 -0500 (EST) To: Guillaume Cottenceau Cc: Markus Schaber , pgsql-jdbc@postgresql.org Subject: Re: impossible to update rows specifying columns with NULL 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> Comments: In-reply-to Guillaume Cottenceau message dated "01 Mar 2005 15:12:21 +0100" Date: Tue, 01 Mar 2005 13:03:48 -0500 Message-ID: <19062.1109700228@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/13 X-Sequence-Number: 12406 Guillaume Cottenceau writes: > Markus Schaber 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