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 A90305284E for ; Sun, 24 Jul 2005 19:26:30 -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 90981-02 for ; Sun, 24 Jul 2005 22:26: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 C641F52802 for ; Sun, 24 Jul 2005 19:26:19 -0300 (ADT) 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 (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DwovN-0003vW-H3; Mon, 25 Jul 2005 10:26:21 +1200 Message-ID: <42E4158D.3020902@opencloud.com> Date: Mon, 25 Jul 2005 10:26:21 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "emergency.shower@gmail.com" Cc: pgsql-jdbc@postgresql.org Subject: Re: Timestamp weirdness References: In-Reply-To: X-Enigmail-Version: 0.90.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.242 tagged_above=0 required=5 tests=AWL, TO_ADDRESS_EQ_REAL X-Spam-Level: X-Archive-Number: 200507/275 X-Sequence-Number: 13423 emergency.shower@gmail.com wrote: > With PostgreSQL 8.0.3 and the postgresql-jdbc-8.1dev-400 > JDBC driver, there are a number of problems when writing timestamps to > and reading them from the database. Have you read the long and involved threads that started a few days ago on pgsql-jdbc? It's worth reading them in the archives if you haven't already. Basically, these problems are known about and we're trying to hash out a reasonable solution.. > Here's the behaviour that I would expect: > > 1) The values in the database should not depend on the database's > local time zone. Since WITH TIME ZONE <-> WITHOUT TIME ZONE conversions use the server's TimeZone setting, this requires that there are no implicit conversions between the two happening on the setTimestamp() / getTimestamp() paths. > 2) When writing to a TIMESTAMP WITH TIME ZONE field, the driver should > not perform any time zone conversions and should store the Timestamp's > (UTC) y, M, d, H, m, s values directly to the database. The Calendar, > if given, should be ignored. > > 3) When writing to a TIMESTAMP WITHOUT TIME ZONE field, the driver > should calculate the Timestamp's y, M, d, H, m, s values in the given > Calendar's time zone and should store these values in the database. > > 4) When reading from a TIMESTAMP WITH TIME ZONE field, the driver > should create a Timestamp by interpreting the y, M, d, H, m, s values > as UTC timestamp fields. The Calendar, if given, should be ignored. > > 5) When reading from a TIMESTAMP WITHOUT TIME ZONE field, the driver > should create a Timestamp by interpreting the y, M, d, H, m, s values > in the context of the given Calendar. (3 and 5: ... or the JVM's default Calendar if none is specified) This is also the behaviour I'd want, but I don't think I have 100% agreement on that from everyone yet. -O