Re: BUG #4972: RFE: convert timestamps to fractional seconds - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4972: RFE: convert timestamps to fractional seconds
Date
Msg-id 2360.1249917342@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #4972: RFE: convert timestamps to fractional seconds  (Richard Neill <rn214@cam.ac.uk>)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Huge speed penalty using <>TRUE instead of =FALSE
Next
From: "Hiroshi Saito"
Date:
Subject: Re: BUG #4961: pg_standby.exe crashes with no args