Re: Time difference changed in 7.2 (3rd time post and hoping

From: Thomas Lockhart <lockhart(at)fourpalms(dot)org>
To: "Gurunandan R(dot) Bhat" <grbhat(at)exocore(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Time difference changed in 7.2 (3rd time post and hoping
Date: 2002-02-21 17:43:14
Message-ID: 3C7531B2.ED72A814@fourpalms.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> The difference between two times (interval) seems to have undergone a
> change from 7.1 to 7.2.

In 7.1 and earlier, the "time - time" operation was converted to "time -
interval" which returned a time. So the result was normalized to a
positive time of day.

In 7.2, we have an explicit operator (and function) defined to do "time
- time", and it returns an interval. Since intervals are allowed to be
signed, it does not normalize back to a positive value.

I *think* that is better behavior, but that does not help your problem.
If you really need the old behavior (which was really by omission, not
by design) then you could modify the routine "time_mi_time", probably
defined in src/backend/utils/adt/date.c.

There is a cast function available in 7.2 to force an interval back to a
time, but it seems to return NULL if the interval is negative. So you
would have to wrap that in a case statement to ensure a positive value
for input.

I'm happy to continue discussing what the *correct* behavior should be,
though if there is some guidance in SQL99 we would try to follow that.

- Thomas

In response to

Browse pgsql-general by date

  From Date Subject
Next Message paul simdars 2002-02-21 17:46:18 Re: ANY GOOD USER'S GUIDE ONLINE?? (with simple examples)
Previous Message makistrigas 2002-02-21 17:41:06 Can I import a model in PostgreSQL?