Skip site navigation (1) Skip section navigation (2)

Re: [BUG?] Extreme dates

From: Markus Schaber <schabios(at)logi-track(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [BUG?] Extreme dates
Date: 2004-05-19 13:50:02
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Hi, Kris,

On Mon, 17 May 2004 15:45:12 -0500 (EST)
Kris Jurka <books(at)ejurka(dot)com> wrote:

> > [timestamps like 0002-10-30 are incorrectly seen as 2030-02-10].
> Yes, that's a bug alright.  I've fixed this in both the stable and 
> development cvs trees.  While looking at this I noticed that the
> timestamp code has no provisions for BC dates, so if you're working
> with years in that area, that's something to be aware of.  Fixing that
> has gone on the todo list, but I wanted to get this fix out to you
> now.

I just notified the change in the JDBC CVS, and have a (very small)

sbuf.append("0") is less efficient than sbuf.append('0').

The first reason is that for storing "0", there is a String object
created by the jvm, with an associated internal char[] array, which is
bound to the Class instance, while '0' as a constant scalar character is
no extra object. 

And the second reason is that, as the StringBuffer source shows, adding
a String to a StringBuffer is much more work including a call to
System.ArrayCopy, while adding a simple character is just ensuring the
capacity and putting it in.

Interestingly, the lines below your insertion, already use chars, while
a little bit above, there's another example adding a single-byte String
(maybe because of lazyness to quote a ' inside of '').

So if you feel like peephole-optimizing, you can apply the attached
patch, if not, don't mind.

Thanks for your patience,
Markus Schaber
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schabios(at)logi-track(dot)com |

Attachment: jdbccharpatch.diff
Description: text/plain (913 bytes)

In response to

pgsql-jdbc by date

Next:From: owDate: 2004-05-19 20:20:42
Subject: Re: [BUG?] Extreme dates
Previous:From: Alban MathieuDate: 2004-05-19 13:23:58
Subject: Driver JDBC3 build 213 for postgreSQL 7.4

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group