Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id BB4D19FB21B for ; Thu, 20 Sep 2007 15:51:20 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 44432-06 for ; Thu, 20 Sep 2007 15:51:08 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from www.goldencode.com (smtp.goldencode.com [72.17.138.114]) by postgresql.org (Postfix) with ESMTP id EFC079FA5C9 for ; Thu, 20 Sep 2007 15:51:08 -0300 (ADT) Received: from emlsrv01.internal.goldencode.com (unknown [192.168.1.51]) by www.goldencode.com (Postfix) with SMTP id 9B8DC1C150 for ; Thu, 20 Sep 2007 13:52:31 -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 20070920144954-41613-7 ; Thu, 20 Sep 2007 14:49:54 -0500 Message-ID: <46F2C0B4.1060306@goldencode.com> Date: Thu, 20 Sep 2007 14:49:24 -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> In-Reply-To: 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/105 X-Sequence-Number: 17527 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. ... Sep 20, 2007 2:30:04 PM com.goldencode.p2j.persist.AbstractWrapperUserType nullSafeSet FINEST: binding '11/30/04' to parameter: 9 Sep 20, 2007 2:30:04 PM com.goldencode.p2j.schema.ImportWorker$Library importTable SEVERE: Error processing import data from /home/ecf/dump/export/gso/turnarnd.d; 100 of ? record(s) successfully processed; 0 record(s) uncommitted due to this error; 0 record(s) dropped java.lang.IllegalArgumentException: Unspecified type comes from here, parameter: 9 at org.postgresql.core.v3.SimpleParameterList.bind(SimpleParameterList.java:68) at org.postgresql.core.v3.SimpleParameterList.setStringParameter(SimpleParameterList.java:120) at org.postgresql.jdbc2.AbstractJdbc2Statement.bindString(AbstractJdbc2Statement.java:2119) at org.postgresql.jdbc2.AbstractJdbc2Statement.setDate(AbstractJdbc2Statement.java:3015) at org.postgresql.jdbc2.AbstractJdbc2Statement.setDate(AbstractJdbc2Statement.java:1296) at com.goldencode.p2j.persist.DateUserType.bindNonNull(DateUserType.java:159) at com.goldencode.p2j.persist.AbstractWrapperUserType.nullSafeSet(AbstractWrapperUserType.java:263) at com.goldencode.p2j.persist.DateUserType.nullSafeSet(DateUserType.java:39) at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:141) at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1617) at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1594) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1850) at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200) at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730) at com.goldencode.p2j.schema.ImportWorker$Library.importTable(ImportWorker.java:710) at com.goldencode.p2j.schema.ImportWorker$Library$1.run(ImportWorker.java:1020) at java.lang.Thread.run(Thread.java:619) ... A number of previous inserts contained "unknown" dates. These were bound with PreparedStatement.setNull(index, Types.DATE) before the test was tripped by the PreparedStatement.setDate(index, date) in the stack trace above. I will run with the enhanced logging patch and upload results shortly. Thanks, Eric Faulhaber