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 B30D952816 for ; Fri, 22 Jul 2005 09:58:55 -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 78273-07 for ; Fri, 22 Jul 2005 12:58:49 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 185D452835 for ; Fri, 22 Jul 2005 09:58:48 -0300 (ADT) Received: (qmail 23525 invoked from network); 22 Jul 2005 12:58:53 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 22 Jul 2005 12:58:53 -0000 In-Reply-To: <24343.1121993659@sss.pgh.pa.us> 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> <26535.1121903232@sss.pgh.pa.us> <42DEEA63.6090507@opencloud.com> <26982.1121906793@sss.pgh.pa.us> <42E03BB8.7090101@opencloud.com> <24343.1121993659@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v733) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <9F702079-9C1A-4606-903A-040F8F4C67FD@fastcrypt.com> Cc: Oliver Jowett , Kris Jurka , Christian Cryder , pgsql-jdbc@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: Timestamp Conversion Woes Redux Date: Fri, 22 Jul 2005 08:58:51 -0400 To: Tom Lane X-Mailer: Apple Mail (2.733) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.015 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/247 X-Sequence-Number: 13395 On 21-Jul-05, at 8:54 PM, Tom Lane wrote: > Oliver Jowett writes: > >> i.e. currently the core of the problem is this behaviour: >> > > >> template1=# select '2005-01-01 15:00:00 >> +1000'::timestamptz::timestamp; >> timestamp >> --------------------- >> 2005-01-01 18:00:00 >> (1 row) >> > > Well, the current interpretation is that timestamptz -> timestamp > produces a timestamp representing what the timestamptz equates to in > your current TimeZone. I do not foresee changing that behavior > when/if > we add explicit TZ info to timestamptz --- it would break just about > every existing app that uses this conversion. > > In any case, this wouldn't solve Christian's complaint, because the > root > of his problem is that the value ever goes through timestamptz at all. > That is necessarily going to "munge" values that don't correspond to > legal local times in whatever zone you are using. > > The more I think about this, the more I think that the correct > solution > must include having the driver set TimeZone = UTC (and complain if the > app tries to change it). This really isn't an option. We can't impose limits on the application like this. > Then you can specify parameter types as either > timestamp or timestamptz, it doesn't really matter, because > conversions > between them on the server side will be no-ops. When you convert a > Java > Timestamp to send to the server, you always convert it using a UTC > Calendar object. I'm not sure if the setTimestamp variants with a > Calendar are special in this regime; arguably you should ignore the > supplied Calendar, on the principle that you know what the > Timestamp is > supposed to mean. > > regards, tom lane > > ---------------------------(end of > broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > >