Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id AC8A26332AC for ; Thu, 23 Apr 2009 05:24:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 20006-01 for ; Thu, 23 Apr 2009 05:24:28 -0300 (ADT) X-Greylist: delayed 00:10:08.598822 by SQLgrey-1.7.6 Received: from mail2.fintrading.com (mail.fintrading.com [195.2.100.100]) by mail.postgresql.org (Postfix) with ESMTP id E957863254D for ; Thu, 23 Apr 2009 05:24:28 -0300 (ADT) Received: from chipmunk (unknown [81.198.70.254]) by mail2.fintrading.com (Postfix) with ESMTPA id 9295138113BE for ; Thu, 23 Apr 2009 11:13:29 +0300 (EEST) From: "Peter" To: Subject: JDBC problem with dates and ANYELEMENT type Date: Thu, 23 Apr 2009 11:13:28 +0300 Message-ID: <00e701c9c3eb$625d43a0$2717cae0$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcnD62HcW5Lehl4XQBC2lGAzMEnTmg== Content-Language: en-us X-MailScanner-ID: 9295138113BE.20513 X-greatnowhere.com-MailScanner: Found to be clean X-greatnowhere.com-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-6.8, required 6, autolearn=not spam, ALL_TRUSTED -1.80, BAYES_00 -5.00) X-greatnowhere.com-MailScanner-From: peter@greatnowhere.com MailScanner-NULL-Check: 1241079211.73369@EERddeZSqONTHln7dxC59w X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200904/80 X-Sequence-Number: 19527 We have a function that takes ANYELEMENT type. If the argument is date = (set using setObject(column, datevariable, Types.DATE)) the server = throws error: ERROR: could not determine polymorphic type because input has type = "unknown" I checked JDBC sources and seems like AbstractJdbc2Statement does this: public void setDate(int i, java.sql.Date d, java.util.Calendar cal) = throws SQLException { checkClosed(); if (d =3D=3D null) { setNull(i, Types.DATE); return; } =20 if (cal !=3D null) cal =3D (Calendar)cal.clone(); // 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 // "local midnight in +0100", but if we go via date it = interprets it // as local midnight in the server's timezone: // template1=3D# select '2005-01-01+0100'::timestamptz; // timestamptz =20 // ------------------------ // 2005-01-01 02:00:00+03 // (1 row) // template1=3D# select '2005-01-01+0100'::date::timestamptz; // timestamptz =20 // ------------------------ // 2005-01-01 00:00:00+03 // (1 row) bindString(i, connection.getTimestampUtils().toString(cal, d), = Oid.UNSPECIFIED); } So it indeed sets =E2=80=98unspecified=E2=80=99 type which works fine if = your target datatype is defined, but fails miserably on ANYELEMENT. Any suggestions how to work around this so we can still use ANYELEMENT = and pass in DATE? Peter