Re: Timestamp weirdness

From: "emergency(dot)shower(at)gmail(dot)com" <emergency(dot)shower(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Timestamp weirdness
Date: 2005-07-25 22:02:16
Message-ID: bdf1a0980507251502f4b68af@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 7/25/05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> [...]
> 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.

If I TIMESTAMP WITH TIME ZONE is implemented on the server as a
(timestamp, time zone)-pair, the server should be able to cast
TIMESTAMP WITH TIME ZONE correctly to TIMESTAMP WITHOUT TIME ZONE as
described in the SQL standard:

From TIMESTAMP WITH TIME ZONE to TIMESTAMP WITHOUT TIME ZONE
TargetValue = SourceValue.UTC + SourceValue.TimeZone

This cast is something like a conversion from a instance in time to a
local time representation.

In this case I would propose to send (if possible) timestamp and time
zone to the server, no matter if we'll write a TIMESTAMP WITH TIME
ZONE or a TIMESTAMP WITHOUT TIME ZONE value. We could have some hope
to get correct results then.

Regards,
Alex

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message emergency.shower@gmail.com 2005-07-25 22:51:58 Re: Timestamp Summary
Previous Message Dennis Gesker 2005-07-25 21:18:55 Re: JdbcRowSet Problem