Something wrong with binding timestamp values - Mailing list pgsql-jdbc

From Peter Eisentraut
Subject Something wrong with binding timestamp values
Date
Msg-id 200612061458.32156.peter_e@gmx.net
Whole thread Raw
Responses Re: Something wrong with binding timestamp values  (Mark Lewis <mark.lewis@mir3.com>)
List pgsql-jdbc
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/

pgsql-jdbc by date:

Previous
From: Brendon Bentley
Date:
Subject: Re: Use Driver to Create database?
Next
From: Mark Lewis
Date:
Subject: Re: Something wrong with binding timestamp values