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/