Re: Interval support for Postgres

From: Oliver Siegmar <o(dot)siegmar(at)vitrado(dot)de>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Interval support for Postgres
Date: 2005-04-29 15:38:15
Message-ID: 200504291738.16354.o.siegmar@vitrado.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
pgjdbc_interval5.diff.gz application/x-gzip 4.1 KB

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2005-04-29 20:42:26 Re: Interval support for Postgres
Previous Message David Gagnon 2005-04-29 14:11:20 help .. calling VACUUM FULL ANALYSE via JDBC make my production server restarting ?!?!?!? Please help :-(