pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Manoj Ganesan <manoj.ganesan@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Inconsistency between timezones
Date: Tue, 15 Sep 2009 15:18:23 -0500
Message-ID: <4b7f2c670909151318r58681e8eo75ecb32259b4937c@mail.gmail.com> (raw)

Hi,

I am confused about how the driver interprets (if at all it does) timezones
to and from the database. When I run the following queries directly on the
database, these are the results I receive:

query: select clock_timestamp() + interval '15 hours'
result: "2009-09-16 06:06:33.801-05"

query: select date_trunc('day', clock_timestamp() + interval '15 hours')
result: "2009-09-16 00:00:00-05"

The above are the values I would expect as well. However, when I run the
same two queries (immediately after) from Java (via the JDBC driver), these
are the results:

query: select clock_timestamp() + interval '15 hours'
result: "2009-09-16 06:08:44.751"

query: select date_trunc('day', clock_timestamp() + interval '15 hours')
result: "2009-09-15 19:00:00.0"

As you can see, the first query yields the *expected* results. However, the
second result seems to have seen some timezone conversion from GMT to
Central Time somewhere. I would assume that clock_timestamp() used inside a
function, or outside a function should show similar results. Replacing
clock_timestamp() with current_timestamp gives the same results. Am I
missing something here?

JDBC driver version: 8.1.404
Server version: 8.3

Thanks a bunch,
Manoj

view thread (2+ messages)  latest in thread

Message-ID: <4b7f2c670909151318r58681e8eo75ecb32259b4937c@mail.gmail.com>
Permalink:  ../4b7f2c670909151318r58681e8eo75ecb32259b4937c@mail.gmail.com/
Also on:    postgresql.org/message-id/4b7f2c670909151318r58681e8eo75ecb32259b4937c@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: manoj.ganesan@gmail.com
  Subject: Re: Inconsistency between timezones
  In-Reply-To: <4b7f2c670909151318r58681e8eo75ecb32259b4937c@mail.gmail.com>
  References: <4b7f2c670909151318r58681e8eo75ecb32259b4937c@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