From: Do, Leon \(Leon\) <leondo@lucent.com>
To: Dave Cramer <pg@fastcrypt.com>
To: imad <immaad@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: help with front/backend datatype converting
Date: Tue, 14 Nov 2006 10:52:04 -0600
Message-ID: <D1EE06BA46B1E4449AF9A4F2FBEE1861285FED@ILEXC2U01.ndc.lucent.com> (raw)
In-Reply-To: <A3C30E98-3D7F-429B-B8EB-D7A5D53F1821@fastcrypt.com>
Dave,
There are actually bugs in the Postgres timestamp string. See below.
> -----Original Message-----
> From: Dave Cramer [mailto:pg@fastcrypt.com]
> Sent: Saturday, November 11, 2006 8:00 AM
> To: imad
> Cc: Do, Leon (Leon); pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] help with front/backend datatype converting
>
>
> On 11-Nov-06, at 6:40 AM, imad wrote:
>
> > On 11/11/06, Do, Leon (Leon) <leondo@lucent.com> wrote:
> >>
> >>
> >>
> >>
> >>
> >>
> >> Dave,
> >>
> >>
> >>
> >> I see you raised a lot of issues about this problem but I don't
> >> have any
> >> suggestion as of now. I'll think about it.
> >>
> >>
> >>
> >> On the side, the timezone for timestamp is always sending in this
> >> format:
> >>
> >> 2006-11-10 14:36:19.213000 -0500
> >>
> >>
> >>
> >> should it be
> >>
> >> 2006-11-10 14:36:19.213000 -05:00
> >
> > this is better.
> Why ? 0500 is perfectly acceptable to postgres
[Do, Leon (Leon)]
I think postgres has a few bugs in this area. When timezone doesn't
have a semicolon between hour and min, TimestampUtil.java cann't handle
it. The firstNonDigits method call below returns all four digits and
assigns them to timezone hour variable.
In the TimestampUtils.java
// Possibly read timezone.
sep = charAt(s, start);
if (sep == '-' || sep == '+') {
int tzsign = (sep == '-') ? -1 : 1;
int tzhr, tzmin;
end = firstNonDigit(s, start+1); // Skip +/-
tzhr = number(s, start+1, end);
start = end;
sep = charAt(s, start);
if (sep == ':') {
end = firstNonDigit(s, start+1); // Skip ':'
tzmin = number(s, start+1, end);
start = end;
} else {
tzmin = 0;
}
And for the second bugs, fractional part of the second (e.g.
14:36:19.213000) seem to be interpreted incorrectly when converting to
Java Date. 213000 would round up as additional 3.52 mins.
Postgres timestamp
2006-11-10 14:36:19.213000 -05:00
to Java Date
2006-11-10 14:39:52.0 -05:00
Would somebody help to fix these bugs?
thanks
Leon Do
> >
> >
> > --Imad
> > www.EnterpriseDB.com
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 7: You can help support the PostgreSQL project by donating at
> >
> > http://www.postgresql.org/about/donate> >
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: leondo@lucent.com, pg@fastcrypt.com, immaad@gmail.com
Subject: Re: help with front/backend datatype converting
In-Reply-To: <D1EE06BA46B1E4449AF9A4F2FBEE1861285FED@ILEXC2U01.ndc.lucent.com>
References: <A3C30E98-3D7F-429B-B8EB-D7A5D53F1821@fastcrypt.com> <D1EE06BA46B1E4449AF9A4F2FBEE1861285FED@ILEXC2U01.ndc.lucent.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