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 DE03C529D1 for ; Wed, 20 Jul 2005 20:47:21 -0300 (ADT) 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 94963-07 for ; Wed, 20 Jul 2005 23:47:18 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9F690529B1 for ; Wed, 20 Jul 2005 20:47:16 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6KNlDDk026536; Wed, 20 Jul 2005 19:47:13 -0400 (EDT) To: Oliver Jowett Cc: Kris Jurka , Christian Cryder , pgsql-jdbc@postgresql.org Subject: Re: Timestamp Conversion Woes Redux In-reply-to: <42DEDB5A.9000803@opencloud.com> References: <90876a9e05071810503606d431@mail.gmail.com> <16335.1121714809@sss.pgh.pa.us> <10C90079-DD0A-43D7-9389-7486803F0AB1@fastcrypt.com> <42DC37AC.5030704@opencloud.com> <42DCF0C9.4030501@opencloud.com> <23396.1121781259@sss.pgh.pa.us> <392278AB-987F-40CF-B59D-DDF53B9A4ACF@fastcrypt.com> <90876a9e050719093261c52c64@mail.gmail.com> <42DDF238.8090601@opencloud.com> <42DEDB5A.9000803@opencloud.com> Comments: In-reply-to Oliver Jowett message dated "Thu, 21 Jul 2005 11:16:42 +1200" Date: Wed, 20 Jul 2005 19:47:12 -0400 Message-ID: <26535.1121903232@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/207 X-Sequence-Number: 13355 Oliver Jowett writes: > I really don't think the driver should be touching TimeZone :/ The idea of tracking the server timezone and using it locally for conversions of incoming data would avoid that gripe. I am not sure however that Christian's basic complaint is solvable. The problem here is very simple: the semantics of SQL TIMESTAMP WITHOUT TIME ZONE do not match Java's Timestamp, no how, no way. For instance, '2004-04-04 02:30' is an unconditionally valid timestamp-without-zone, no matter what anybody's timezone setting is. However, if you try to interpret it as local time in a US DST-observing zone, you have a problem. You can never convert this value to timestamptz and back in a DST-observing zone and not have it change ... which is basically what Christian is hoping for. But there is *no* timestamptz value that will decode as 02:30, because that's not a valid value for timestamptz. I think any solution that tries to work 100% for both flavors of SQL timestamp is simply doomed to failure --- unless there are more semantics to Java's Timestamp type than I've gathered from this discussion. The impression I have is that Timestamp is supposed to represent absolute time instants (ie, there's no additional "what time zone is this in" info needed to determine the exact equivalent GMT time), which would make it equivalent to timestamptz. timestamp-without-zone is a fundamentally different critter, because it does not assume that there is any such thing as absolute GMT-equivalent time. regards, tom lane