pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Something wrong with binding timestamp values
Date: Wed, 6 Dec 2006 14:58:31 +0100
Message-ID: <200612061458.32156.peter_e@gmx.net> (raw)

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/



view thread (5+ messages)  latest in thread

Message-ID: <200612061458.32156.peter_e@gmx.net>
Permalink:  ../200612061458.32156.peter_e@gmx.net/
Also on:    postgresql.org/message-id/200612061458.32156.peter_e@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: peter_e@gmx.net
  Subject: Re: Something wrong with binding timestamp values
  In-Reply-To: <200612061458.32156.peter_e@gmx.net>
  References: <200612061458.32156.peter_e@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox