Re: Possible bug in PGInterval class

From: Kris Jurka <books(at)ejurka(dot)com>
To: Ľubomír Varga <luvar(at)plaintext(dot)sk>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Possible bug in PGInterval class
Date: 2009-09-02 00:01:11
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-jdbc

On Mon, 31 Aug 2009, ?ubom?r Varga wrote:

> I have noticed imho bad behaviour of add methods for PGInterval class.
> (org.postgresql.util.PGInterval)
> First is unlogical adding sum to parameter and not to object on which is
> method invoked. (this is also writen in javadoc, so I accept it)

This is to be similar to the add(Date) and add(Calendar) functions. For
them you wan't to add the interval to the passed object.

> Second, critical for me, is to not using modulo in addition. So if you
> add 55 minutes to 55 minutes, you get 110 minutes instead of 1 hour and
> 50 minutes.

For minutes and hours, it would be OK, but when rolling hours into days or
days into months, context is needed to know if you are near a daylight
saving time change or how many days are in the month. For this reason we
don't manipulate the values and leave them as is.

Kris Jurka

In response to


Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2009-09-02 00:03:11 Re: Possible bug in PGInterval class
Previous Message Ľubomír Varga 2009-08-31 19:34:12 Possible bug in PGInterval class