Thread: timespan/2

timespan/2

From
Carlos Fonseca
Date:
Dear all,

I need to compute the half of given timespan values, and was surprised to
see that, e.g., ('1h'::timespan)/2 doesn't work, whereas
('1h'::timespan)/(2::timespan) does. This isn't just inconvenient, it
looks wrong as well: try '1h'::timespan/'0s300ms'::timespan,
when you really mean '1h'::timespan/0.3.

Is this a bug or a design decision? Shouldn't division of two timespan
values return a float, and division of a timespan value by an int/float
return a timespan? I am using postgresql v6.4.2.

Please Cc: any replies to me, as I am not on the list (for now)...

TIA,

Carlos