pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vit Timchishin <tivvpgsqljdbc@gtech-ua.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Something wrong with binding timestamp values
Date: Wed, 06 Dec 2006 16:46:28 +0200
Message-ID: <4576D7C4.4040602@gtech-ua.com> (raw)
In-Reply-To: <1165415895.9734.286.camel@archimedes>
References: <200612061458.32156.peter_e@gmx.net>
	<1165415895.9734.286.camel@archimedes>

Mark Lewis wrote:
> It's to work around the fact that JDBC only knows about one Timestamp
> type, while PG knows about more.  It ends up being better in most cases
> to send the type as unknown and let the server disambiguate to the
> correct type than to guess about the type and maybe guess wrong.
>
> This was a recent change, which is why it used to work for you but now
> doesn't.  It was known that cases like yours which call overloaded
> functions may require an explicit cast, something like "SELECT
> date_trunc('day', ?::timestamp)", but it was decided that it's better to
> force a cast in some cases than to do things demonstrably wrong in other
> cases (which the older driver versions were wont to do).
>
> You can dig through the archives for more of the gory details.
>
>   

Actually I am not having this problem, but I see every time people has
problems with it.
Would not it be helpful to create, say, PostgreTimestamp extends
java.sql.Timestamp and PostgreZonedTimestamp extends java.sql.Timestamp.
Then check if one uses this classes in setTimestamp/setObject and in
this case use definite bindings. And even more, return one of this types
from getTimestamp, so that some applications that do read/write will
work better even without knowing this problem.
Other application, of course, will be forced to use ::timestamp OR this
new classes explicitly. But this gives more flexibility - one would may
choose to change query text OR parameter creating and it may be much
easier in some cases to change parameter creating then sql texts.




view thread (5+ messages)  latest in thread

Message-ID: <4576D7C4.4040602@gtech-ua.com>
Permalink:  ../4576D7C4.4040602@gtech-ua.com/
Also on:    postgresql.org/message-id/4576D7C4.4040602@gtech-ua.com

 · 

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: tivvpgsqljdbc@gtech-ua.com
  Subject: Re: Something wrong with binding timestamp values
  In-Reply-To: <4576D7C4.4040602@gtech-ua.com>
  References: <200612061458.32156.peter_e@gmx.net> <1165415895.9734.286.camel@archimedes> <4576D7C4.4040602@gtech-ua.com>

* 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