Tom Lane wrote: > 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.
OK, what about 1.5 * '1 day'. By my logic multiplication and division were by definition imprecise. Is the logic that we spill down only for non-integral values? > > 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. If that's what people want, it is fine by me. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings