Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tom Lane wrote:
>> Urgh. I think this is a serious thinko in Michael Glaesemann's rewrite
>> of interval_mul.
> The reason interval_justify_hours is called by interval multiplication
> is so multipling an interval '2 days, 4 hours' by 10 doesn't return
> values like 20 days, 40 hours, etc, but instead something like '21 days,
> 16 hours', which seems more reasonable.
That's utterly WRONG, though. The entire *point* of the 8.1 change is
that days and hours are incommensurable. We are forced to down-convert
in some cases --- for example, we can't compute a useful result for
"0.5 * '1 day'" without imputing "12 hours" as the equivalent of 0.5 day
--- but we never have to and never should up-convert, except by explicit
user command ... which is what the justify_hours function is for.
> One solution would be
> to suggest the use of interval_justify_hours() in the documentation for
> interval multiplication, and prevent the justification from happening
> automatically.
Exactly. Forcing the justification to happen is broken, because there's
no way to get the other behavior.
regards, tom lane