pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christian Cryder <c.s.cryder@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Timestamp Conversion Woes Redux
Date: Tue, 19 Jul 2005 10:32:35 -0600
Message-ID: <90876a9e050719093261c52c64@mail.gmail.com> (raw)
In-Reply-To: <Pine.BSO.4.56.0507191100110.68@leary.csoft.net>
References: <90876a9e05071810503606d431@mail.gmail.com>
	<16335.1121714809@sss.pgh.pa.us>
	<10C90079-DD0A-43D7-9389-7486803F0AB1@fastcrypt.com>
	<42DC37AC.5030704@opencloud.com>
	<C36F2D5F-093E-489C-8D6F-A67B746EA6C8@fastcrypt.com>
	<42DCF0C9.4030501@opencloud.com>
	<23396.1121781259@sss.pgh.pa.us>
	<392278AB-987F-40CF-B59D-DDF53B9A4ACF@fastcrypt.com>
	<Pine.BSO.4.56.0507191100110.68@leary.csoft.net>

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).



view thread (92+ messages)  latest in thread

Message-ID: <90876a9e050719093261c52c64@mail.gmail.com>
Permalink:  ../90876a9e050719093261c52c64@mail.gmail.com/
Also on:    postgresql.org/message-id/90876a9e050719093261c52c64@mail.gmail.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: c.s.cryder@gmail.com
  Subject: Re: Timestamp Conversion Woes Redux
  In-Reply-To: <90876a9e050719093261c52c64@mail.gmail.com>
  References: <90876a9e05071810503606d431@mail.gmail.com> <16335.1121714809@sss.pgh.pa.us> <10C90079-DD0A-43D7-9389-7486803F0AB1@fastcrypt.com> <42DC37AC.5030704@opencloud.com> <C36F2D5F-093E-489C-8D6F-A67B746EA6C8@fastcrypt.com> <42DCF0C9.4030501@opencloud.com> <23396.1121781259@sss.pgh.pa.us> <392278AB-987F-40CF-B59D-DDF53B9A4ACF@fastcrypt.com> <Pine.BSO.4.56.0507191100110.68@leary.csoft.net> <90876a9e050719093261c52c64@mail.gmail.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