X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx2.hub.org [200.46.204.254]) by postgresql.org (Postfix) with ESMTP id 15F2811F7757 for ; Fri, 14 Apr 2006 12:32:41 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: -0.489 X-Spam-Level: X-Spam-Status: No, score=-0.489 required=5 tests=[AWL=-1.841, BAYES_00=-2.599, FORGED_RCVD_HELO=0.135, SPF_HELO_SOFTFAIL=2.432, SPF_SOFTFAIL=1.384] Received: from postgresql.org ([200.46.204.71]) by localhost (mx2.hub.org [200.46.204.254]) (amavisd-new, port 10024) with ESMTP id r4vIsE6SN2Go for ; Fri, 14 Apr 2006 12:32:21 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (unknown [212.211.145.186]) by postgresql.org (Postfix) with ESMTP id F400C11F732D for ; Fri, 14 Apr 2006 12:32:20 -0300 (ADT) Received: from kingfisher.intern.logix-tt.com (Ta967.t.pppool.de [89.55.169.103]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id AB884656C1; Fri, 14 Apr 2006 17:33:12 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 19D73181C1F3F; Fri, 14 Apr 2006 17:32:32 +0200 (CEST) Message-ID: <443FC08F.8020505@logix-tt.com> Date: Fri, 14 Apr 2006 17:32:31 +0200 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jeff Hubbach Cc: pgsql-jdbc@postgresql.org Subject: Re: Possible regression: setNull() usage changed from 7.4 References: In-Reply-To: X-Enigmail-Version: 0.93.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Archive-Number: 200604/107 X-Sequence-Number: 15041 Hi, Jeff, Jeff Hubbach wrote: > select count(*) from users where usernam = ? and > (?::integer is null or userid != ?) > > stmt.setString(1,'blah'); > stmt.setNull(2,java.sql.Types.NULL); > stmt.setNull(3,java.sql.Types.NULL); > > This code gives the server the type information it needs by doing an > explicit cast. It seems to work, but was wondering if there are any > problems you see with it (or if you have a better/cleaner way to go > about it). The correct way, IMHO, would be to use two different prepared statements, one with the userid, and another one without. HTH, Markus -- Markus Schaber | Logical Tracking&Tracing International AG Dipl. Inf. | Software Development GIS Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org