Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id B7C139FB2E2 for ; Thu, 20 Sep 2007 16:28:25 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 85218-02-5 for ; Thu, 20 Sep 2007 16:28:12 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from www.goldencode.com (www.goldencode.com [72.17.138.114]) by postgresql.org (Postfix) with ESMTP id 8671A9FB268 for ; Thu, 20 Sep 2007 16:28:15 -0300 (ADT) Received: from emlsrv01.internal.goldencode.com (unknown [192.168.1.51]) by www.goldencode.com (Postfix) with SMTP id 3E65B1C14E for ; Thu, 20 Sep 2007 14:29:38 -0400 (EDT) Received: from [192.168.1.103] (ecf.internal.goldencode.com [192.168.1.103]) by emlsrv01.internal.goldencode.com (Hethmon Brothers Smtpd) id 20070920152703-7756-7 ; Thu, 20 Sep 2007 15:27:03 -0500 Message-ID: <46F2C982.2070209@goldencode.com> Date: Thu, 20 Sep 2007 15:26:58 -0400 From: Eric Faulhaber Reply-To: ecf@goldencode.com Organization: Golden Code Development User-Agent: Thunderbird 1.5.0.13 (X11/20070824) MIME-Version: 1.0 To: Kris Jurka CC: pgsql-jdbc@postgresql.org Subject: Re: Batch INSERT failing with error 22P02 References: <46EEE4EF.80608@goldencode.com> <46EFF277.1090309@goldencode.com> <46F29BBC.20400@goldencode.com> <46F2C0B4.1060306@goldencode.com> In-Reply-To: <46F2C0B4.1060306@goldencode.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/106 X-Sequence-Number: 17528 Eric Faulhaber wrote: > Kris Jurka wrote: >> 2) Where's the unspecified type coming from? I've put in a hack to >> the driver to throw an exception when the first unspecified type is >> set which should hopefully provide enough information to track it >> back to your application. Unspecified types are perfectly legal, so >> this isn't a real problem, but it may be informational. > > I turned on some additional logging in our code to see what data is > being bound to each parameter in our UserType implementation. It > seems the unspecified type is coming from a Date object bound with > PreparedStatement.setDate(int, java.sql.Date). At least, this is the > first parameter that triggers the test. How relevant is the following change to this mystery? This is an excerpt from a diff of AbstractJdbc2Statement between the versions we've been discussing, specifically, the internals of the setDate(int, Date, Calendar) method: --- postgresql-jdbc-8.1-408.src/org/postgresql/jdbc2/AbstractJdbc2Statement.java 2006-11-05 00:44:44.000000000 -0500 +++ postgresql-jdbc-8.2-506.src/org/postgresql/jdbc2/AbstractJdbc2Statement.java 2007-07-27 05:01:53.000000000 -0400 ... @@ -2897,7 +2919,7 @@ if (cal != null) cal = (Calendar)cal.clone(); - // We must use INVALID here, or inserting a Date-with-timezone into a + // We must use UNSPECIFIED here, or inserting a Date-with-timezone into a // timestamptz field does an unexpected rotation by the server's TimeZone: // // We want to interpret 2005/01/01 with calendar +0100 as @@ -2916,7 +2938,7 @@ // 2005-01-01 00:00:00+03 // (1 row) - bindString(i, connection.getTimestampUtils().toString(cal, d), Oid.INVALID); + bindString(i, connection.getTimestampUtils().toString(cal, d), Oid.UNSPECIFIED); } public void setTime(int i, Time t, java.util.Calendar cal) throws SQLException ... I mean, it obviously explains where the unspecified type is coming from, but how likely is that to trigger the FE/BE type mismatch we're seeing many records later? Thanks, Eric Faulhaber