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 14EEB8B9D70 for ; Mon, 14 Feb 2005 22:14:26 +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 79144-04 for ; Mon, 14 Feb 2005 22:14:22 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id B6B0E8B9D0C for ; Mon, 14 Feb 2005 22:14:20 +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 1D0oTp-0007pF-00; Tue, 15 Feb 2005 11:14:09 +1300 Message-ID: <421122AF.9010602@opencloud.com> Date: Tue, 15 Feb 2005 11:14:07 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) X-Accept-Language: en-us, en MIME-Version: 1.0 To: matthias.malsy@sme.de Cc: pgsql-jdbc@postgresql.org Subject: Re: Daylight Safing Problem 2004-10-31 00:00:00 (UTC) References: <22997.193.128.157.68.1108396149.squirrel@morpheus.sme.de> In-Reply-To: <22997.193.128.157.68.1108396149.squirrel@morpheus.sme.de> X-Enigmail-Version: 0.89.5.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.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/103 X-Sequence-Number: 12283 matthias.malsy@sme.de wrote: > Description: > ------------ > I reduced my problem to a simple testcase just storing and loading a date > from the database. The tescase fails for the time interval of > 2004-10-31 00:00:00 to 01:00:00 (UTC). In order to stay ANSI conform, > I use the 'timestamp [without timezone]' data type. > - create table mdso_demo (id int, d timestamp) > > Scenario: > --------- > I am storing sales data (containing sales date/time) in a database by > ignoring the timezone in order to make it comparable across multiple > timezones. The sales date is deliverd by a foreign system as a String > and is parsed by an UTC-SimpleDateFormatter. After safing and loading, > the date (and its milliseconds) differs by 1 hour. > Output (running on CET/CEST): [...] The problem is that the raw value stored in the database is "31 Oct 2004 02:00:00" with no timezone information. There are two possible instants in time in the CET/CEST timezone that match this: (initially in CEST, UTC+02) 31 Oct 2004 02:00:00 CEST == 00:00:00 UTC (at 3am, clocks go back an hour to 2am; now in CET, UTC+01) 31 Oct 2004 02:00:00 CET == 01:00:00 UTC Java's date parser happens to pick the second case when given a raw "2am local time" value. So this is not a driver bug, it is something of a design flaw in your schema, since "timestamp without time zone" cannot identify a unique instant in local time when daylight savings is involved. -O