Re: Interval support for Postgres - Mailing list pgsql-jdbc

From Oliver Siegmar
Subject Re: Interval support for Postgres
Date
Msg-id 200504291738.16354.o.siegmar@vitrado.de
Whole thread Raw
In response to Re: Interval support for Postgres  (Kris Jurka <books@ejurka.com>)
Responses Re: Interval support for Postgres
List pgsql-jdbc
Hi Kris,

On Friday 29 April 2005 12:35, Kris Jurka wrote:
> > > My one remaining question is about the roll function.  What is the
> > > purpose of roll, don't we want add?
> >
> > a) because the database doesn't return "oversized" values - so it doesn't
> > matter using add() or roll()
>
> Surely it does, consider a calendar 2001-01-01 00:00:45 and an interval of
> 20 seconds.  roll gives 2001-01-01 00:00:05 while add gives the
> correct 2001-01-01 00:01:05

Oh...I must have goofed. You're right - I tried to implement a working add()
version.

In the initial implementation of add() (a never sent implementation) I was too
demanding. It is just not possible to "roll" every date forth and back and
get the initial date, of course. Just think of Mar 31 plus one month and then
one month back...that cannot be Mar 31 and that's okay. This has to be
considered when testing - not any starting date can be used to roll forth and
back.

> Shouldn't this be "microseconds + 500 / 1000" (although it does need to
> account for the sign.

Yeah, good point - applied that, too.


Give pgjdbc_interval5.diff a new try ;-)


Oliver

Attachment

pgsql-jdbc by date:

Previous
From: David Gagnon
Date:
Subject: help .. calling VACUUM FULL ANALYSE via JDBC make my production server restarting ?!?!?!? Please help :-(
Next
From: Kris Jurka
Date:
Subject: Re: Interval support for Postgres