pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedhelp with front/backend datatype converting
17+ messages / 7 participants
[nested] [flat]
* help with front/backend datatype converting
@ 2006-11-10 20:58 Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 17+ messages in thread
From: Do, Leon (Leon) @ 2006-11-10 20:58 UTC (permalink / raw)
To: pgsql-jdbc
Hi,
It looks like PostgreSQL JDBC always converting a column value to text
before sending it to the Backend server. Is there a way to stop this
behavior?
I am using the following piece of code to set the timestamp value:
ByteArrayInputStream is = new ByteArrayInputStream(bdata);
prepstmt.setBinaryStream(1,is,bdata.length);
java.sql.Timestamp sqltime = new
java.sql.Timestamp(System.currentTimeMillis());
prepstmt.setTimestamp(2,sqltime);
When the backend server receives the parse message, the oid type for
binary data is set but the oid type for timestamp is not set.
When the bind message arrives, the format type for binary data is binary
and the format type for timestamp is text and there is no way to know
what is the type of the value anymore. Can I configure to disable text
converting feature?
thanks
Leon Do
Lucent Technologies
Mobility Software Engineer
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
@ 2006-11-10 21:15 ` Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
0 siblings, 1 reply; 17+ messages in thread
From: Dave Cramer @ 2006-11-10 21:15 UTC (permalink / raw)
To: Do, Leon (Leon) <leondo@lucent.com>; +Cc: pgsql-jdbc
Hi Leon,
No, currently there is no way to do this. It is possible, but this is
probably the worst data type to try this with. Postgresql has two
timestamp types, 1 with timezone, 1 without, jdbc has no knowledge of
this. Do you have suggestions on how to resolve this ? Also consider
the actual timezone, what if the timezone of the server is different
than the timezone of the client. To add to the problem, it is
possible for the server to keep dates/timestamps as 64bit integers,
or Floating point values. The client has to send the data in exactly
the right format.
Sorry to only outline the problems without constructive solutions.
Dave
On 10-Nov-06, at 3:58 PM, Do, Leon (Leon) wrote:
> Hi,
>
>
>
> It looks like PostgreSQL JDBC always converting a column value to
> text before sending it to the Backend server. Is there a way to
> stop this behavior?
>
>
>
> I am using the following piece of code to set the timestamp value:
>
>
>
> ByteArrayInputStream is = new ByteArrayInputStream(bdata);
>
>
>
> prepstmt.setBinaryStream(1,is,bdata.length);
>
>
>
> java.sql.Timestamp sqltime = new
>
> java.sql.Timestamp
> (System.currentTimeMillis());
>
> prepstmt.setTimestamp(2,sqltime);
>
>
>
>
>
> When the backend server receives the parse message, the oid type
> for binary data is set but the oid type for timestamp is not set.
>
>
>
> When the bind message arrives, the format type for binary data is
> binary and the format type for timestamp is text and there is no
> way to know what is the type of the value anymore. Can I
> configure to disable text converting feature?
>
>
>
> thanks
>
>
>
>
>
> Leon Do
>
> Lucent Technologies
>
> Mobility Software Engineer
>
>
>
>
>
>
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
@ 2006-11-10 22:27 ` Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
0 siblings, 1 reply; 17+ messages in thread
From: Do, Leon \(Leon\) @ 2006-11-10 22:27 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; +Cc: pgsql-jdbc
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
with the colon between hour and min?
thanks again
Leon Do
________________________________
From: Dave Cramer [mailto:pg@fastcrypt.com]
Sent: Friday, November 10, 2006 4:15 PM
To: Do, Leon (Leon)
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] help with front/backend datatype converting
Hi Leon,
No, currently there is no way to do this. It is possible, but this is
probably the worst data type to try this with. Postgresql has two
timestamp types, 1 with timezone, 1 without, jdbc has no knowledge of
this. Do you have suggestions on how to resolve this ? Also consider the
actual timezone, what if the timezone of the server is different than
the timezone of the client. To add to the problem, it is possible for
the server to keep dates/timestamps as 64bit integers, or Floating point
values. The client has to send the data in exactly the right format.
Sorry to only outline the problems without constructive solutions.
Dave
On 10-Nov-06, at 3:58 PM, Do, Leon (Leon) wrote:
Hi,
It looks like PostgreSQL JDBC always converting a column value to text
before sending it to the Backend server. Is there a way to stop this
behavior?
I am using the following piece of code to set the timestamp value:
new
prepstmt.setBinaryStream(1,is,bdata.); java.sql.Timestamp
sqltime =
When the backend server receives the parse message, the oid type for
binary data is set but the oid type for timestamp is not set.
When the bind message arrives, the format type for binary data is binary
and the format type for timestamp is text and there is no way to know
what is the type of the value anymore. Can I configure to disable text
converting feature?
thanks
Leon Do
Lucent Technologies
Mobility Software Engineer
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
@ 2006-11-11 11:40 ` imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
0 siblings, 1 reply; 17+ messages in thread
From: imad @ 2006-11-11 11:40 UTC (permalink / raw)
To: Do, Leon (Leon) <leondo@lucent.com>; +Cc: Dave Cramer <pg@fastcrypt.com>; pgsql-jdbc
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.
--Imad
www.EnterpriseDB.com
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
@ 2006-11-11 13:00 ` Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
0 siblings, 1 reply; 17+ messages in thread
From: Dave Cramer @ 2006-11-11 13:00 UTC (permalink / raw)
To: imad <immaad@gmail.com>; +Cc: Do, Leon (Leon) <leondo@lucent.com>; pgsql-jdbc
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
>
>
> --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
>
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
@ 2006-11-14 16:52 ` Do, Leon (Leon) <leondo@lucent.com>
2006-11-14 23:05 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
0 siblings, 1 reply; 17+ messages in thread
From: Do, Leon \(Leon\) @ 2006-11-14 16:52 UTC (permalink / raw)
To: Dave Cramer <pg@fastcrypt.com>; imad <immaad@gmail.com>; +Cc: pgsql-jdbc
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
> >
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
@ 2006-11-14 23:05 ` Oliver Jowett <oliver@opencloud.com>
2006-11-15 04:36 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
0 siblings, 1 reply; 17+ messages in thread
From: Oliver Jowett @ 2006-11-14 23:05 UTC (permalink / raw)
To: Do, Leon \(Leon\) <leondo@lucent.com>; +Cc: Dave Cramer <pg@fastcrypt.com>; imad <immaad@gmail.com>; pgsql-jdbc
Do, Leon (Leon) wrote:
> 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.
Does the server ever generate timezones like this?
> 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.
Testcase please?
-O
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-14 23:05 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
@ 2006-11-15 04:36 ` Do, Leon (Leon) <leondo@lucent.com>
2006-11-17 11:34 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
0 siblings, 1 reply; 17+ messages in thread
From: Do, Leon \(Leon\) @ 2006-11-15 04:36 UTC (permalink / raw)
To: Oliver Jowett <oliver@opencloud.com>; +Cc: Dave Cramer <pg@fastcrypt.com>; imad <immaad@gmail.com>; pgsql-jdbc
> -----Original Message-----
> From: Oliver Jowett [mailto:oliver@opencloud.com]
> Sent: Tuesday, November 14, 2006 6:06 PM
> To: Do, Leon (Leon)
> Cc: Dave Cramer; imad; pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] help with front/backend datatype converting
>
> Do, Leon (Leon) wrote:
>
> > 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.
>
> Does the server ever generate timezones like this?
I haven't tested the server side but I know the client generates that
format but it didn't take what it generated.
>
> > 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.
>
> Testcase please?
Sorry, this was my mistake when using java SimpleDateFormatter class and
assumed the second fractional part as millisecond instead of nanosecond.
thanks
Leon Do
>
> -O
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-14 23:05 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2006-11-15 04:36 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
@ 2006-11-17 11:34 ` Oliver Jowett <oliver@opencloud.com>
2007-01-05 00:35 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 17+ messages in thread
From: Oliver Jowett @ 2006-11-17 11:34 UTC (permalink / raw)
To: Do, Leon \(Leon\) <leondo@lucent.com>; +Cc: Dave Cramer <pg@fastcrypt.com>; imad <immaad@gmail.com>; pgsql-jdbc
Do, Leon (Leon) wrote:
> I haven't tested the server side but I know the client generates that
> format but it didn't take what it generated.
Well, in general we only care about parsing what the server generates,
not what the driver generates.
One exception might be updateable resultsets.
The solution is probably to fix the generation side so we generate the
same format as the server produces.
-O
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-14 23:05 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2006-11-15 04:36 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-17 11:34 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
@ 2007-01-05 00:35 ` Kris Jurka <books@ejurka.com>
2007-01-05 15:53 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
0 siblings, 1 reply; 17+ messages in thread
From: Kris Jurka @ 2007-01-05 00:35 UTC (permalink / raw)
To: Oliver Jowett <oliver@opencloud.com>; +Cc: Do, Leon (Leon) <leondo@lucent.com>; Dave Cramer <pg@fastcrypt.com>; imad <immaad@gmail.com>; pgsql-jdbc
On Fri, 17 Nov 2006, Oliver Jowett wrote:
> Do, Leon (Leon) wrote:
>
>> I haven't tested the server side but I know the client generates that
>> format but it didn't take what it generated.
>
> Well, in general we only care about parsing what the server generates, not
> what the driver generates.
>
> One exception might be updateable resultsets.
>
> The solution is probably to fix the generation side so we generate the same
> format as the server produces.
>
I have fixed this in CVS for 8.0, 8.1, 8.2, and 8.3dev.
Kris Jurka
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-14 23:05 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2006-11-15 04:36 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-17 11:34 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2007-01-05 00:35 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
@ 2007-01-05 15:53 ` Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 17:17 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 17+ messages in thread
From: Do, Leon \(Leon\) @ 2007-01-05 15:53 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; Oliver Jowett <oliver@opencloud.com>; +Cc: Dave Cramer <pg@fastcrypt.com>; imad <immaad@gmail.com>; pgsql-jdbc
It would be nice if you can add a support for parsing hh:mm as well as
hhmm to conform to ISO8601. There are many other uses of this class. I
sent the changes earlier.
Thanks
Leon Do
> -----Original Message-----
> From: Kris Jurka [mailto:books@ejurka.com]
> Sent: Thursday, January 04, 2007 7:35 PM
> To: Oliver Jowett
> Cc: Do, Leon (Leon); Dave Cramer; imad; pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] help with front/backend datatype converting
>
>
>
> On Fri, 17 Nov 2006, Oliver Jowett wrote:
>
> > Do, Leon (Leon) wrote:
> >
> >> I haven't tested the server side but I know the client
> generates that
> >> format but it didn't take what it generated.
> >
> > Well, in general we only care about parsing what the server
> generates,
> > not what the driver generates.
> >
> > One exception might be updateable resultsets.
> >
> > The solution is probably to fix the generation side so we
> generate the
> > same format as the server produces.
> >
>
> I have fixed this in CVS for 8.0, 8.1, 8.2, and 8.3dev.
>
> Kris Jurka
>
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-14 23:05 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2006-11-15 04:36 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-17 11:34 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2007-01-05 00:35 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
2007-01-05 15:53 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
@ 2007-01-05 17:17 ` Kris Jurka <books@ejurka.com>
2007-01-05 19:40 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
0 siblings, 1 reply; 17+ messages in thread
From: Kris Jurka @ 2007-01-05 17:17 UTC (permalink / raw)
To: Do, Leon (Leon) <leondo@alcatel-lucent.com>; +Cc: Oliver Jowett <oliver@opencloud.com>; Dave Cramer <pg@fastcrypt.com>; imad <immaad@gmail.com>; pgsql-jdbc
On Fri, 5 Jan 2007, Do, Leon (Leon) wrote:
> It would be nice if you can add a support for parsing hh:mm as well as
> hhmm to conform to ISO8601. There are many other uses of this class. I
> sent the changes earlier.
>
This class is not part of any public API and is intended for usage by the
driver only. We have no desire to add or maintain code beyond what is
necessary for the driver. You are certainly free to copy and reuse this
code under the BSD license, but you will have to maintain your own code
changes unless you can demonstrate a usefulness for them within the
driver.
Kris Jurka
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-14 23:05 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2006-11-15 04:36 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-17 11:34 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2007-01-05 00:35 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
2007-01-05 15:53 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 17:17 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
@ 2007-01-05 19:40 ` Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 19:52 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 17+ messages in thread
From: Do, Leon \(Leon\) @ 2007-01-05 19:40 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: Oliver Jowett <oliver@opencloud.com>; Dave Cramer <pg@fastcrypt.com>; imad <immaad@gmail.com>; pgsql-jdbc
> -----Original Message-----
> From: Kris Jurka [mailto:books@ejurka.com]
> Sent: Friday, January 05, 2007 12:18 PM
> To: Do, Leon (Leon)
> Cc: Oliver Jowett; Dave Cramer; imad; pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] help with front/backend datatype converting
>
>
>
> On Fri, 5 Jan 2007, Do, Leon (Leon) wrote:
>
> > It would be nice if you can add a support for parsing hh:mm
> as well as
> > hhmm to conform to ISO8601. There are many other uses of
> this class.
> > I sent the changes earlier.
> >
>
> This class is not part of any public API and is intended for
> usage by the driver only. We have no desire to add or
> maintain code beyond what is necessary for the driver. You
> are certainly free to copy and reuse this code under the BSD
> license, but you will have to maintain your own code changes
> unless you can demonstrate a usefulness for them within the driver.
Leon-it is actually a bug in the class. The server could possibly sends
a timezone in 'hhmm' format and the class treats the entire 4 digits as
number of hours which is totally incorrect. I already provided the
quick fix so it won't take too much effort to put it in the load. If
you tell me the direction then I can add it in the load so you don't
have to spend extra effort.
>
> Kris Jurka
>
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-14 23:05 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2006-11-15 04:36 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-17 11:34 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2007-01-05 00:35 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
2007-01-05 15:53 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 17:17 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
2007-01-05 19:40 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
@ 2007-01-05 19:52 ` Kris Jurka <books@ejurka.com>
2007-01-05 21:46 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
0 siblings, 1 reply; 17+ messages in thread
From: Kris Jurka @ 2007-01-05 19:52 UTC (permalink / raw)
To: Do, Leon (Leon) <leondo@alcatel-lucent.com>; +Cc: Oliver Jowett <oliver@opencloud.com>; Dave Cramer <pg@fastcrypt.com>; imad <immaad@gmail.com>; pgsql-jdbc
On Fri, 5 Jan 2007, Do, Leon (Leon) wrote:
> Leon-it is actually a bug in the class. The server could possibly sends
> a timezone in 'hhmm' format and the class treats the entire 4 digits as
> number of hours which is totally incorrect. I already provided the
> quick fix so it won't take too much effort to put it in the load. If
> you tell me the direction then I can add it in the load so you don't
> have to spend extra effort.
>
Please demonstrate how it is possible to generate a timezone in this
format. I can't seem to do it:
jurka=# set timezone='Asia/Tehran';
SET
jurka=# select now();
now
----------------------------------
2007-01-05 22:56:26.065258+03:30
Kris Jurka
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-14 23:05 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2006-11-15 04:36 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-17 11:34 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2007-01-05 00:35 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
2007-01-05 15:53 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 17:17 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
2007-01-05 19:40 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 19:52 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
@ 2007-01-05 21:46 ` Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 21:58 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-06 03:30 ` Re: help with front/backend datatype converting Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 17+ messages in thread
From: Do, Leon \(Leon\) @ 2007-01-05 21:46 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: Oliver Jowett <oliver@opencloud.com>; Dave Cramer <pg@fastcrypt.com>; imad <immaad@gmail.com>; pgsql-jdbc
Postgresql8.1 documentation:
Table 8-12. Time Zone Input
Example Description
PST Pacific Standard Time
-8:00 ISO-8601 offset for PST
-800 ISO-8601 offset for PST
-8 ISO-8601 offset for PST
zulu Military abbreviation for UTC
z Short form of zulu
It can takes any input. You cann't assume it only return hh:mm. When
things can go wrong it will go wrong.
Refer to Appendix B for a list of time zone names that are recognized
for input.
> -----Original Message-----
> From: Kris Jurka [mailto:books@ejurka.com]
> Sent: Friday, January 05, 2007 2:52 PM
> To: Do, Leon (Leon)
> Cc: Oliver Jowett; Dave Cramer; imad; pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] help with front/backend datatype converting
>
>
>
> On Fri, 5 Jan 2007, Do, Leon (Leon) wrote:
>
> > Leon-it is actually a bug in the class. The server could possibly
> > sends a timezone in 'hhmm' format and the class treats the entire 4
> > digits as number of hours which is totally incorrect. I already
> > provided the quick fix so it won't take too much effort to
> put it in
> > the load. If you tell me the direction then I can add it
> in the load
> > so you don't have to spend extra effort.
> >
>
> Please demonstrate how it is possible to generate a timezone
> in this format. I can't seem to do it:
>
> jurka=# set timezone='Asia/Tehran';
> SET
> jurka=# select now();
> now
> ----------------------------------
> 2007-01-05 22:56:26.065258+03:30
>
The Postgresql 8.1 document indicates that it can take the following
inputs:
Table 8-12. Time Zone Input
Example Description
PST Pacific Standard Time
-8:00 ISO-8601 offset for PST
-800 ISO-8601 offset for PST
-8 ISO-8601 offset for PST
The driver should expect timezone output to be one of its form as well.
Murphy's Law, "If anything can go wrong, it will" so we cann't hardcode
that way forever.
In my situation, I have to work with multiple DBs. Since timestamp data
type is varied across different DB vendors therefore I have to use the
varchar to store the timestamp string.
Ex:
create table test {
timestampfield varchar(50)
);
Insert into test values ("2007-01-05 23:20:25.122222+06:30");
Insert into test values ("2006-01-05 23:20:25.122222+0650");
I must allow two forms of timezones as indicated in the document
Using PG JDBC driver, I can do the following:
ResultSet rs = stmt.getResultSet();
rs.getTimestamp();
That the way I use it but it is a valid according to the document.
Leon Do
>
> Kris Jurka
>
>
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-14 23:05 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2006-11-15 04:36 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-17 11:34 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2007-01-05 00:35 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
2007-01-05 15:53 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 17:17 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
2007-01-05 19:40 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 19:52 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
2007-01-05 21:46 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
@ 2007-01-05 21:58 ` Do, Leon (Leon) <leondo@alcatel-lucent.com>
1 sibling, 0 replies; 17+ messages in thread
From: Do, Leon \(Leon\) @ 2007-01-05 21:58 UTC (permalink / raw)
To: Do, Leon \(Leon\) <leondo@alcatel-lucent.com>; Kris Jurka <books@ejurka.com>; +Cc: Oliver Jowett <oliver@opencloud.com>; Dave Cramer <pg@fastcrypt.com>; imad <immaad@gmail.com>; pgsql-jdbc
If you are reading the email you'll see paragraphs at the beginning.
Please ignore them and go to the embeded responses later in the page.
Leon Do
> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Do, Leon (Leon)
> Sent: Friday, January 05, 2007 4:46 PM
> To: Kris Jurka
> Cc: Oliver Jowett; Dave Cramer; imad; pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] help with front/backend datatype converting
>
> Postgresql8.1 documentation:
>
> Table 8-12. Time Zone Input
> Example Description
> PST Pacific Standard Time
> -8:00 ISO-8601 offset for PST
> -800 ISO-8601 offset for PST
> -8 ISO-8601 offset for PST
> zulu Military abbreviation for UTC
> z Short form of zulu
>
> It can takes any input. You cann't assume it only return
> hh:mm. When things can go wrong it will go wrong.
>
>
>
>
> Refer to Appendix B for a list of time zone names that are
> recognized for input.
>
> > -----Original Message-----
> > From: Kris Jurka [mailto:books@ejurka.com]
> > Sent: Friday, January 05, 2007 2:52 PM
> > To: Do, Leon (Leon)
> > Cc: Oliver Jowett; Dave Cramer; imad; pgsql-jdbc@postgresql.org
> > Subject: Re: [JDBC] help with front/backend datatype converting
> >
> >
> >
> > On Fri, 5 Jan 2007, Do, Leon (Leon) wrote:
> >
> > > Leon-it is actually a bug in the class. The server could
> possibly
> > > sends a timezone in 'hhmm' format and the class treats
> the entire 4
> > > digits as number of hours which is totally incorrect. I already
> > > provided the quick fix so it won't take too much effort to
> > put it in
> > > the load. If you tell me the direction then I can add it
> > in the load
> > > so you don't have to spend extra effort.
> > >
> >
> > Please demonstrate how it is possible to generate a
> timezone in this
> > format. I can't seem to do it:
> >
> > jurka=# set timezone='Asia/Tehran';
> > SET
> > jurka=# select now();
> > now
> > ----------------------------------
> > 2007-01-05 22:56:26.065258+03:30
> >
>
> The Postgresql 8.1 document indicates that it can take the following
> inputs:
> Table 8-12. Time Zone Input
> Example Description
> PST Pacific Standard Time
> -8:00 ISO-8601 offset for PST
> -800 ISO-8601 offset for PST
> -8 ISO-8601 offset for PST
>
>
> The driver should expect timezone output to be one of its
> form as well.
> Murphy's Law, "If anything can go wrong, it will" so we
> cann't hardcode that way forever.
>
> In my situation, I have to work with multiple DBs. Since
> timestamp data type is varied across different DB vendors
> therefore I have to use the varchar to store the timestamp string.
>
> Ex:
> create table test {
> timestampfield varchar(50)
> );
>
>
> Insert into test values ("2007-01-05 23:20:25.122222+06:30");
> Insert into test values ("2006-01-05 23:20:25.122222+0650");
>
> I must allow two forms of timezones as indicated in the document
>
> Using PG JDBC driver, I can do the following:
>
> ResultSet rs = stmt.getResultSet();
> rs.getTimestamp();
>
> That the way I use it but it is a valid according to the document.
>
> Leon Do
>
>
> >
> > Kris Jurka
> >
> >
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate
>
^ permalink raw reply [nested|flat] 17+ messages in thread
* Re: help with front/backend datatype converting
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` Re: help with front/backend datatype converting imad <immaad@gmail.com>
2006-11-11 13:00 ` Re: help with front/backend datatype converting Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-14 23:05 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2006-11-15 04:36 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-17 11:34 ` Re: help with front/backend datatype converting Oliver Jowett <oliver@opencloud.com>
2007-01-05 00:35 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
2007-01-05 15:53 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 17:17 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
2007-01-05 19:40 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 19:52 ` Re: help with front/backend datatype converting Kris Jurka <books@ejurka.com>
2007-01-05 21:46 ` Re: help with front/backend datatype converting Do, Leon (Leon) <leondo@alcatel-lucent.com>
@ 2007-01-06 03:30 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 17+ messages in thread
From: Tom Lane @ 2007-01-06 03:30 UTC (permalink / raw)
To: Do, Leon \(Leon\) <leondo@alcatel-lucent.com>; +Cc: Kris Jurka <books@ejurka.com>; Oliver Jowett <oliver@opencloud.com>; Dave Cramer <pg@fastcrypt.com>; imad <immaad@gmail.com>; pgsql-jdbc
"Do, Leon \(Leon\)" <leondo@alcatel-lucent.com> writes:
> It can takes any input. You cann't assume it only return hh:mm.
Yes you can --- see EncodeTimezone(). I concur with Kris' opinion
that the driver need not cater for output formats the server will
never generate. Especially not if it's explicitly setting DateStyle,
as I seem to remember it does.
One thing that possibly *does* need fixed as of 8.2 is that the server
can generate hh:mm:ss if the timezone has a fractional-minute UTC
offset. I do not believe there are any modern timezones that do, but
quite a lot do if you check dates 100 or so years ago.
regression=# set timezone = 'Europe/Dublin';
SET
regression=# select now() - '100 years'::interval;
?column?
-------------------------------------
1907-01-06 03:28:22.483631-00:25:21
(1 row)
regards, tom lane
^ permalink raw reply [nested|flat] 17+ messages in thread
end of thread, other threads:[~2007-01-06 03:30 UTC | newest]
Thread overview: 17+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-11-10 20:58 help with front/backend datatype converting Do, Leon (Leon) <leondo@lucent.com>
2006-11-10 21:15 ` Dave Cramer <pg@fastcrypt.com>
2006-11-10 22:27 ` Do, Leon (Leon) <leondo@lucent.com>
2006-11-11 11:40 ` imad <immaad@gmail.com>
2006-11-11 13:00 ` Dave Cramer <pg@fastcrypt.com>
2006-11-14 16:52 ` Do, Leon (Leon) <leondo@lucent.com>
2006-11-14 23:05 ` Oliver Jowett <oliver@opencloud.com>
2006-11-15 04:36 ` Do, Leon (Leon) <leondo@lucent.com>
2006-11-17 11:34 ` Oliver Jowett <oliver@opencloud.com>
2007-01-05 00:35 ` Kris Jurka <books@ejurka.com>
2007-01-05 15:53 ` Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 17:17 ` Kris Jurka <books@ejurka.com>
2007-01-05 19:40 ` Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 19:52 ` Kris Jurka <books@ejurka.com>
2007-01-05 21:46 ` Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-05 21:58 ` Do, Leon (Leon) <leondo@alcatel-lucent.com>
2007-01-06 03:30 ` Tom Lane <tgl@sss.pgh.pa.us>
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