Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 4F0379F9C35 for ; Wed, 6 Dec 2006 09:58:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 41301-10 for ; Wed, 6 Dec 2006 09:58:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from gauss.credativ.com (ipx11302.ipxserver.de [212.112.227.254]) by postgresql.org (Postfix) with ESMTP id C31E39F93E5 for ; Wed, 6 Dec 2006 09:58:36 -0400 (AST) Received: from bell.credativ.de (p50896577.dip.t-dialin.net [80.137.101.119]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by gauss.credativ.com (Postfix) with ESMTP id 0CECED7604 for ; Wed, 6 Dec 2006 14:58:35 +0100 (CET) From: Peter Eisentraut To: pgsql-jdbc@postgresql.org Subject: Something wrong with binding timestamp values Date: Wed, 6 Dec 2006 14:58:31 +0100 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200612061458.32156.peter_e@gmx.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/38 X-Sequence-Number: 16270 This code PreparedStatement st = conn.prepareStatement("SELECT date_trunc('day', ?)"); st.setString(1, "2006-12-17"); ResultSet rs = st.executeQuery(); fails, as might be expected, because date_trunc(unknown, varchar) doesn't exist. But this code: PreparedStatement st = conn.prepareStatement("SELECT date_trunc('day', ?)"); st.setTimestamp(1, new Timestamp(222222222)); ResultSet rs = st.executeQuery(); fails with postgresql-8.1-408.jdbc3.jar with ERROR: function date_trunc("unknown", "unknown") is not unique It works correctly with postgresql-8.0-318.jdbc3.jar. What is wrong here? Why does a timestamp value end up being bound as "unknown"? -- Peter Eisentraut http://developer.postgresql.org/~petere/