Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 411F4632C7D for ; Tue, 15 Sep 2009 17:18:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 06981-01 for ; Tue, 15 Sep 2009 20:18:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pz0-f203.google.com (mail-pz0-f203.google.com [209.85.222.203]) by mail.postgresql.org (Postfix) with ESMTP id 44A8D632883 for ; Tue, 15 Sep 2009 17:18:45 -0300 (ADT) Received: by pzk41 with SMTP id 41so3682851pzk.4 for ; Tue, 15 Sep 2009 13:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:content-type; bh=AEZ22XlIwvKkiHWSeO5VedWCwi9eEFWNWRZ8msaY3xk=; b=BgmDilNohwz4/cBVKe4dzL4vLtERkI/DCbBw4wVUtRlIBnctMrrmrWCQuhuop+SzmF 7anVBdAPYeAuO4RTiNskVwY4txVxwf25pFIMhb9Pm+bv/5G3PujXB+su1ZbXizPXuOJJ vJdvVzixErufytcEV0+h5kqJ99XX0uj8//dTI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=Owou758Tg9PvxFP7uR4/4vPjM0bJcppQ74fEaDU/KbpVS49NpEXvemKkFjlPh5Xre5 XgZY8iK44g9Dp6XFsou9Ot1V268nq2CbmpIrEU1DTrMcNg7ZCLFHKAqxLjEQ2fVWljyo kxXDbSIQg66BFXY0roUt5lY5pReiPWB658gz8= MIME-Version: 1.0 Received: by 10.140.134.17 with SMTP id h17mr1071230rvd.282.1253045923454; Tue, 15 Sep 2009 13:18:43 -0700 (PDT) From: Manoj Ganesan Date: Tue, 15 Sep 2009 15:18:23 -0500 Message-ID: <4b7f2c670909151318r58681e8eo75ecb32259b4937c@mail.gmail.com> Subject: Inconsistency between timezones To: pgsql-jdbc@postgresql.org Content-Type: multipart/alternative; boundary=000e0cd2be1c279f510473a37d17 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200909/17 X-Sequence-Number: 19964 --000e0cd2be1c279f510473a37d17 Content-Type: text/plain; charset=ISO-8859-1 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 --000e0cd2be1c279f510473a37d17 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 dire= ctly 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_tr= unc('day', clock_timestamp() + interval '15 hours')=A0=A0= =A0
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 (i= mmediately 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')=A0=A0=A0
res= ult: "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 clo= ck_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
--000e0cd2be1c279f510473a37d17--