Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aNUar-0008QS-S0 for pgsql-jdbc@arkaria.postgresql.org; Mon, 25 Jan 2016 00:01:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aNUaq-0005lv-MR for pgsql-jdbc@arkaria.postgresql.org; Mon, 25 Jan 2016 00:01:16 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aNUaK-0005DM-Oj for pgsql-jdbc@postgresql.org; Mon, 25 Jan 2016 00:00:44 +0000 Received: from virtual1.potentialtech.com ([69.25.178.43] helo=mail.potentialtech.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aNUaD-00017V-JE for pgsql-jdbc@postgresql.org; Mon, 25 Jan 2016 00:00:42 +0000 Received: from working.home (c-67-171-70-156.hsd1.pa.comcast.net [67.171.70.156]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.potentialtech.com (Postfix) with ESMTPSA id 8468E24BEE0 for ; Sun, 24 Jan 2016 19:00:36 -0500 (EST) Date: Sun, 24 Jan 2016 19:00:35 -0500 From: Bill Moran To: pgsql-jdbc@postgresql.org Subject: Confusion about JDBC + TIME WITHOUT TIME ZONE Message-Id: <20160124190035.78da947487fa2559c162cdcf@potentialtech.com> X-Mailer: Sylpheed 3.4.2 (GTK+ 2.24.25; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org 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