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

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
Message-ID: alpine.BSO.2.00.0909011954290.14550@leary.csoft.net (view raw or flat)
Thread:
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

Responses

pgsql-jdbc by date

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

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