Re: work in progress: timestamp patch - Mailing list pgsql-jdbc

From Christian Cryder
Subject Re: work in progress: timestamp patch
Date
Msg-id 90876a9e05072612478f36c41@mail.gmail.com
Whole thread Raw
In response to Re: work in progress: timestamp patch  (Dave Cramer <pg@fastcrypt.com>)
List pgsql-jdbc
On 7/25/05, Dave Cramer <pg@fastcrypt.com> wrote:
> One of the times he is trying to stick in the db is a non-existant
> time if it is associated with a time zone
>
> stmt.execute("INSERT INTO Foo (t1) VALUES ('2005-04-03 02:29:43.0')");
>
> in any US timezone this time does not exist. In US/Mountain timezone
> this inserts as  2005-04-03 03:29:43.0' note the hour has incremented from
> 2 to 3

Just a clarification guys.
a) this time is only invalid in a US timezone that uses Daylight Savings
b) if you insert it via Statement like this, it inserts into the db
just fine; if you insert it using PreparedStatement the value will get
munged
c) once you have the value in the DB, the question is: "How can I read
the value and then rewrite it without munging it"

The only answer to c right now is
a) reconfigure both your client and your server to run in UTC (or some
other non-DST zone)
b) reconfigure your client to turn DST off, and then adjust the server
zone programatically just for the scope of the connection (that was
what my little patch was about)

Neither of these solutions is particularly appealing. I'm surprised
the basic data-integrity aspects of this issue don't bother people
more...

Christian

pgsql-jdbc by date:

Previous
From: Christian Cryder
Date:
Subject: Re: Timestamp Summary
Next
From: Scott Goldstein
Date:
Subject: Client Connection vs. JDBC Connections vs. Postgres processes