pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: emergency.shower@gmail.com <emergency.shower@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Timestamp weirdness
Date: Mon, 25 Jul 2005 10:26:21 +1200
Message-ID: <42E4158D.3020902@opencloud.com> (raw)
In-Reply-To: <bdf1a09805072414582d75b940@mail.gmail.com>
References: <bdf1a09805072414582d75b940@mail.gmail.com>

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



view thread (20+ messages)  latest in thread

Message-ID: <42E4158D.3020902@opencloud.com>
Permalink:  ../42E4158D.3020902@opencloud.com/
Also on:    postgresql.org/message-id/42E4158D.3020902@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, emergency.shower@gmail.com
  Subject: Re: Timestamp weirdness
  In-Reply-To: <42E4158D.3020902@opencloud.com>
  References: <bdf1a09805072414582d75b940@mail.gmail.com> <42E4158D.3020902@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox