Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 25049F5C18C for ; Sat, 12 May 2012 12:06:41 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1STDu2-0007rz-Gy for pgsql-jdbc@postgresql.org; Sat, 12 May 2012 15:06:40 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q4CF6LsH006365; Sat, 12 May 2012 11:06:21 -0400 (EDT) To: Bernard cc: PG-JDBC Mailing List , Maciek Sakrejda Subject: Re: Fwd: Cannot pass null in Parameter in Query for ISNULL In-reply-to: References: Comments: In-reply-to Bernard message dated "Sat, 12 May 2012 20:24:12 +1200" Date: Sat, 12 May 2012 11:06:21 -0400 Message-ID: <6364.1336835181@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201205/27 X-Sequence-Number: 22927 Bernard writes: > May I ask for suggestions for a way forward towards a solution? The long and the short of this is that your application, which presumably knows what it might pass for this parameter, has to provide that type information (by means of using the appropriate setXXX call). If the server's parser tries to guess a type, that will simply move the pain from this case to other cases, namely those where the choice really matters and it guesses wrong. Similarly, the JDBC driver doesn't have enough information to make a correct guess. Having said that, it's interesting to wonder how much would break if setObject were to arbitrarily assume the data type is TEXT. The response to anybody complaining would be more or less what I'm saying to you, which is "don't use setObject if you don't like the results". Again, this would only be shifting the pain from some cases to others, but I wonder whether there would be more or fewer pain cases. regards, tom lane