From: Bill Moran <wmoran@potentialtech.com>
To: pgsql-jdbc@postgresql.org
Subject: Confusion about JDBC + TIME WITHOUT TIME ZONE
Date: Sun, 24 Jan 2016 19:00:35 -0500
Message-ID: <20160124190035.78da947487fa2559c162cdcf@potentialtech.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>
I have a table that has a TIME WITHOUT TIME ZONE column.
When I try to insert via JDBC, the time is always adjusted for the
JVM's time zone. This behavior seems wrong to me. For example:
// Java code:
preparedStatement.setTime(1, Time.valueOf("00:00:10"));
Then, watching the PostgreSQL logs, I see that the value supplied
for parameter #1 is '05:00:10'.
Since my TZ is US Eastern, it appears as if JDBC is adjusting for
the timezone. I don't understand why it would do so, as the whole
point is that TIME WITHOUT TIME ZONE doesn't care, record, or
do anything else with or about the TZ.
To me, this feels like a bug. I'm certainly open to someone explaining
to me why this is the correct behavior, so I can stop understanding
it wrong (should that be the case) but that would have to include an
understanding of how to get the desired behavior. That behavior is
that the time passed in is stored without caring about its time zone.
--
Bill Moran
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
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: wmoran@potentialtech.com
Subject: Re: Confusion about JDBC + TIME WITHOUT TIME ZONE
In-Reply-To: <20160124190035.78da947487fa2559c162cdcf@potentialtech.com>
References: <20160124190035.78da947487fa2559c162cdcf@potentialtech.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