X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5A9E33A3B0B for ; Wed, 1 Dec 2004 00:06:41 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82725-08 for ; Wed, 1 Dec 2004 00:06:35 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 360373A5266 for ; Wed, 1 Dec 2004 00:06:36 +0000 (GMT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1CZI0g-0002tm-00; Wed, 01 Dec 2004 13:06:18 +1300 Message-ID: <41AD0C45.2090002@opencloud.com> Date: Wed, 01 Dec 2004 13:11:49 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 0.9 (X11/20041130) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pg@fastcrypt.com Cc: Tom Lane , Kris Jurka , Antje.Stejskal@ppi.de, pgsql-jdbc@postgresql.org Subject: Re: Bug in JDBC-Driver? References: <6D48B8403D926449BDE8440EC7EEC46D021F2026@max.ppinet.de> <41AC5A33.8020009@fastcrypt.com> <41AC65A0.4070503@fastcrypt.com> <21155.1101832716@sss.pgh.pa.us> <41ACFF96.6090501@fastcrypt.com> In-Reply-To: <41ACFF96.6090501@fastcrypt.com> X-Enigmail-Version: 0.89.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200412/1 X-Sequence-Number: 11667 Dave Cramer wrote: > Well, I'm not going to defend the spec, as it's broken in a few places. Only a few? ;) > However there is no setTimestamp without timezone. java.sql.Timestamp stores UTC milliseconds-since-epoch. It also stores a timezone offset (in minutes?!) and has YMD/HMS accessors -- but all the timezone functionality is deprecated since JDK1.1 in favor of passing the timestamp to an appropriate Calendar object (that has timezone info plus locale-specific formatting logic). So it seems like Timestamp itself is essentially "without timezone". There is PreparedStatement.setTimestamp(column, timestamp) vs. PreparedStatement.setTimestamp(column, timestamp, calendar). It's not clear whether this is meant to do without-timezone vs. with-timezone, though. The javadoc for the second variant talks about using the provided calendar to construct a SQL DATE value, but does that mean "store timestamp with calendar's timezone" or "convert timestamp to local time in the given calendar and store without timezone" or something else again? And the first variant says nothing at all about timezones! ResultSet has getTimestamp(column) and getTimestamp(column, calendar). The second variant claims to do conversion of timestamp without timezone to UTC milliseconds using the given calendar, but only for the "without timezone" case. If you have "with timezone" the conversion to UTC just happens automatically, and there seems to be no way to retrieve the stored timezone information separately. Perhaps the driver is meant to setTimezone() on the supplied calendar, but the javadoc says nothing about this. My head hurts.. How do other JDBC drivers handle this? -O