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 EBBF852A48 for ; Tue, 19 Jul 2005 13:33:22 -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 72662-01 for ; Tue, 19 Jul 2005 16:33:21 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by svr1.postgresql.org (Postfix) with ESMTP id E970752A1B for ; Tue, 19 Jul 2005 13:33:17 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id i30so1231667wra for ; Tue, 19 Jul 2005 09:33:18 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=svmQYZ5YMD3KohIeVL42akW1CzQYmusPJu6L2t7ItDmAZiyOQ6c5Z+uGH1nUWXcTzOD1la7c9A3ezedI/RPj3cftSvTPs/xU+r4WT5sgteSQTUuQfZIlKhEux9StG90yumxU2Lx9XRGocrLL/NZLQzoUzFfwc2A006XMNDEQOaI= Received: by 10.54.127.19 with SMTP id z19mr788438wrc; Tue, 19 Jul 2005 09:32:35 -0700 (PDT) Received: by 10.54.86.16 with HTTP; Tue, 19 Jul 2005 09:32:35 -0700 (PDT) Message-ID: <90876a9e050719093261c52c64@mail.gmail.com> Date: Tue, 19 Jul 2005 10:32:35 -0600 From: Christian Cryder Reply-To: Christian Cryder To: pgsql-jdbc@postgresql.org Subject: Re: Timestamp Conversion Woes Redux In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.111 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200507/142 X-Sequence-Number: 13290 Hi Kris, Dave and I have been talking about this a lot over the past couple of days, and I've provided some sample code that will clearly illustrate the problem. At the heart of the issue is the fact that there needs to be a way to insert Timestamps into the DB using PreparedStatements, where you can indicate to the DB "do not munge this date, thank you very much". Right now, if you are using Timestamps, that will happen regardless of whether you are declaring the timestamp with or without timezone. So to summarize: the sql standard has the notion of 2 kinds of timestamp (w/, w/out timezone). The JDBC API on the other hand doesn't - it's just "timestamp". And so the drivers have to make assumptions about how to send the data across. The current implementation (which uses TIMESTAMPTZ) _guarantees_ the server will remap the time. And that is very much a problem (as my sample code illustrates, especially when you are trying to store zoneless times). As an example: consider what happens when you try and insert a time like 2005-04-03 2:39:00. If daylight savings is turned on, this is not a valid time, because it falls between 2 and 3 AM on the first Sunday in April. So when you try and insert/update it into the db, it will "adjust" it for you. But if this is zoneless data, then it's perfectly legit. Unfortunately, there's no way via the JDBC PreparedStatement (as currently implemented) to keep that munging from happening. And that is very much a problem. I should not have to configure my server to turn daylight savings off in order to get stuff to insert into the DB correctly (after all, other things run on the same server).