Re: Time difference changed in 7.2 (3rd time post and hoping
От | Thomas Lockhart |
---|---|
Тема | Re: Time difference changed in 7.2 (3rd time post and hoping |
Дата | |
Msg-id | 3C7531B2.ED72A814@fourpalms.org обсуждение исходный текст |
Ответ на | Time difference changed in 7.2 (3rd time post and hoping for the best :) ("Gurunandan R. Bhat" <grbhat@exocore.com>) |
Список | 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
В списке pgsql-general по дате отправления: