pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ken Johanson <pg-user@kensystem.com>
To: Pushker Chaubey <pchaubey@vertex.co.in>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Timestamp without Timezone and differing client / server tzs
Date: Thu, 10 Jul 2008 22:49:09 -0600
Message-ID: <4876E645.4080503@kensystem.com> (raw)
In-Reply-To: <48746759.5080507@vertex.co.in>
References: <4873154E.6020808@kensystem.com>
	<4873201F.1000700@opencloud.com>
	<487439D8.2050508@kensystem.com>
	<48743B53.4000002@opencloud.com>
	<48743F0C.6020504@kensystem.com>
	<4874419A.6030705@opencloud.com>
	<48744BE0.1010304@kensystem.com>
	<48746759.5080507@vertex.co.in>

Pushker Chaubey wrote:
> 
> Ken Johanson wrote:
>> The servers and their schema (use-of ts w/o tz are not under my 
>> control; adding with-timezone would likely break apps that transmit 
>> date values with offset already normalized).
> Just wondering, other apps using same database must also be facing the 
> same problem as you are if they operate across various timezones.
> Since all the applications are sharing the same timestamp(without TZ) 
> column they all should follow the same protocol to update and read 
> values for this shared timestamp(without TZ) column.
> 
> We had a similar situation where the schema (having a timestamp without 
> timezone column ) was not under our control and we had clients across 
> various timezone who accessed the database.
> If one client with timezone TZ1 updated the value, the other client with 
> timezone TZ2 did not read the correct value.
> To get around that we agreed on a reference timezone (GMT) so that 
> stored timestamp value would be as per GMT timezone.

I (and the other clients in their real timezones) are using a very 
similar config/protocol. The server is set to UTC and everyone agrees to 
convert the textual/iso8601 representation to it UTC value going out, 
and parse as UTC coming back. Just pass TZ to SimpleDateformat as one 
mean of accomplishing this. It's very easy conceptually. Well, only for 
query and their literal values constructed as in the StringBuffer way etc.

The kicker happens when using PreparedStatements or an overlying API 
that relies on them. We have no control (as I understand so far) over 
how the PG driver does conversion.

So I have to write a layer over some middleware that converts the values 
before passing down to PS (may not be possible though). The inelegant 
part is the server-specific config being stored not in the URL but 
elsewhere... I could get creative and piggyback my own param in the URL 
if I can access it.

So much to ponder. For now there's the political-correctness joy (not) 
of having to inform customer that right now anyway, PG cant do what 
they're doing with database and driver X.

Thanks for your thoughts Pushker,

Ken






view thread (15+ messages)  latest in thread

Message-ID: <4876E645.4080503@kensystem.com>
Permalink:  ../4876E645.4080503@kensystem.com/
Also on:    postgresql.org/message-id/4876E645.4080503@kensystem.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: pg-user@kensystem.com, pchaubey@vertex.co.in
  Subject: Re: Timestamp without Timezone and differing client / server tzs
  In-Reply-To: <4876E645.4080503@kensystem.com>
  References: <4873154E.6020808@kensystem.com> <4873201F.1000700@opencloud.com> <487439D8.2050508@kensystem.com> <48743B53.4000002@opencloud.com> <48743F0C.6020504@kensystem.com> <4874419A.6030705@opencloud.com> <48744BE0.1010304@kensystem.com> <48746759.5080507@vertex.co.in> <4876E645.4080503@kensystem.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