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 2CAC552AF5 for ; Sun, 24 Jul 2005 19:48:18 -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 91843-06 for ; Sun, 24 Jul 2005 22:48:15 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id D4D0952903 for ; Sun, 24 Jul 2005 19:48:13 -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 j6OMmA7N014993; Sun, 24 Jul 2005 18:48:10 -0400 (EDT) To: Oliver Jowett Cc: "emergency.shower@gmail.com" , pgsql-jdbc@postgresql.org Subject: Re: Timestamp weirdness In-reply-to: <42E4158D.3020902@opencloud.com> References: <42E4158D.3020902@opencloud.com> Comments: In-reply-to Oliver Jowett message dated "Mon, 25 Jul 2005 10:26:21 +1200" Date: Sun, 24 Jul 2005 18:48:10 -0400 Message-ID: <14992.1122245290@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/276 X-Sequence-Number: 13424 Oliver Jowett writes: > emergency.shower@gmail.com wrote: >> 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. Surely 4 should read "by interpreting the y...s values as a timestamp in the zone specified as part of the value", not as necessarily UTC. 5 seems ok to me. The difficulty with both 2 and 3 is that the driver has no very good way of knowing whether it's writing to a timestamp with tz or one without. We can know the parameter datatype we send, but if that gets converted to the other type within the server, you're going to get burnt. regards, tom lane