pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: imad <immaad@gmail.com>
To: Richard Cook <awhig@yahoo.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Bug in TimestampUtils.java?
Date: Fri, 10 Nov 2006 14:31:28 +0500
Message-ID: <1f30b80c0611100131h5dd8a74br78c2b944da0e50d8@mail.gmail.com> (raw)
In-Reply-To: <20061109223752.62560.qmail@web60221.mail.yahoo.com>
References: <20061109223752.62560.qmail@web60221.mail.yahoo.com>

I discussed this with a colleague and he thinks this can be an issue of
daylight saving time. Does that make sense to you?

--Imad
www.EnterpriseDB.com


On 11/10/06, Richard Cook <awhig@yahoo.com> wrote:
>
> Imad,
>
> If you look at the source code for the postgres jdbc driver, it retrieves
> the column as a string, then uses the TimeStampUtils class to create a date
> or timestamp out of it. I think the driver is incorrectly setting the
> timezone when it creates the Date object.
>
>
> From AbstractJdbc2ResultSet.java....
>
>  public java.sql.Date getDate(int columnIndex) throws SQLException
>     {
>         return getDate(columnIndex, null);
>     }
>
>
>  public java.sql.Date getDate(int i, java.util.Calendar cal) throws
> SQLException
>     {
>         this.checkResultSet(i);
>
>         if (cal != null)
>             cal = (Calendar)cal.clone();
>
>         return connection.getTimestampUtils().toDate(cal, getString(i));
>     }
>
>
>
>
> ----- Original Message ----
> From: imad <immaad@gmail.com>
> To: Richard Cook <awhig@yahoo.com>
> Cc: pgsql-jdbc@postgresql.org
> Sent: Thursday, November 9, 2006 4:54:15 PM
> Subject: Re: [JDBC] Bug in TimestampUtils.java?
>
> On 11/10/06, Richard Cook <awhig@yahoo.com> wrote:
> >
> > Hi All,
> >
> > I recently ran into a problem that was partially caused by some behaviour
> I
> > found in TimestampUtils.java.  To me it does not seem right...
> >
> > I retrieved a Timestamp Column from Postgres as a Date. The data in the
> > database had a timezone of GMT -0500, the current time was also in GMT
> > -0500. If you look at the date that is returned from resultSet.getDate()
> on
> > a Timestamp column, the timezone for the Date object is -0400. I would
> think
> > that it should be -0500.
>
> I suggest you to confirm it with your database server. Try developing the
> same
> scenario without JDBC and see what you get because connectors are not
> supposed to play with the data they get. It is the server who formats
> everything
> before sending it to the client.
>
> --Imad
> www.EnterpriseDB.com
>
>



view thread (8+ messages)  latest in thread

Message-ID: <1f30b80c0611100131h5dd8a74br78c2b944da0e50d8@mail.gmail.com>
Permalink:  ../1f30b80c0611100131h5dd8a74br78c2b944da0e50d8@mail.gmail.com/
Also on:    postgresql.org/message-id/1f30b80c0611100131h5dd8a74br78c2b944da0e50d8@mail.gmail.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: immaad@gmail.com, awhig@yahoo.com
  Subject: Re: Bug in TimestampUtils.java?
  In-Reply-To: <1f30b80c0611100131h5dd8a74br78c2b944da0e50d8@mail.gmail.com>
  References: <20061109223752.62560.qmail@web60221.mail.yahoo.com> <1f30b80c0611100131h5dd8a74br78c2b944da0e50d8@mail.gmail.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