From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Jan Normann Nielsen <spam(at)dubbekarl(dot)dk> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #1177: JDBC driver doesn't handle all dates correctly |
Date: | 2004-06-22 22:36:23 |
Message-ID: | Pine.BSO.4.56.0406221731130.115@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Tue, 22 Jun 2004, PostgreSQL Bugs List wrote:
>
> The following bug has been logged online:
>
> Bug reference: 1177
> Logged by: Jan Normann Nielsen
> Email address: spam(at)dubbekarl(dot)dk
> PostgreSQL version: 7.4
> Description: JDBC driver doesn't handle all dates correctly
>
> In AbstractJdbc1Statement.setDate(int parameterIndex, java.sql.Date x), the
> date 'x' is converted to a string by using x.toString() before being sent as
> a parameter to a SQL-query, i.e. an INSERT-statement. The JavaDocs specify
> that the result of this this toString method is the same as
>
> new java.text.SimpleDateFormat("yyyy-MM-dd").format(x)
>
> which, according to the documentation for SimpleDateFormat, will zero-pad
> the year if it is less than four digits. This can happen if a very strange
> date is chosen, which this case shows:
>
> java.sql.Date x = new java.sql.Date(Long.MAX_VALUE);
> System.out.println((int) x.toString().charAt(0));
>
I was originally going to label this as a Java bug, but according to this
discussion (login required):
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4510956
they have no intention of making toString work for year values > 9999.
I'll look at working around this on the driver side.
Kris Jurka
From | Date | Subject | |
---|---|---|---|
Next Message | PostgreSQL Bugs List | 2004-06-23 02:32:49 | BUG #1180: incorrect date handling |
Previous Message | Stephan Szabo | 2004-06-22 22:23:10 | Re: BUG #1179: Time comparison fail |