Richard Neill <rn214@cam.ac.uk> writes:
> (b) Nowhere on the page is there a full example for getting
> seconds+microseconds since the epoch
Yeah, we could change that example to include a fractional part in the
timestamp to make this clearer.
> What I think I meant was dividing a differential timestamp by an
> interval. In this case, both should be unambiguously expressed in
> seconds, and the result will be dimensionless.
What you're missing is that intervals are not single numbers, and
are not simply numbers of seconds.
> Do you agree that an explicit cast of a timestamp to a double should work?
Doesn't seem like a particularly good idea. You're free to add such
a cast to your own DBs, of course.
> Do you agree that abs() should be able to operate on an interval?
> select abs( interval '-1 week');
It's not as easy as that, because (once again) intervals aren't single
numbers. For example, what should become of
abs(interval '-1 month +1 day')
The negative of this would be '1 month -1 day'. It's not real clear to
me whether abs() should give that or '1 month 1 day', ie, make all the
fields positive independently.
regards, tom lane