Re: Time span conversion function

From: Brendan Jurd <blakjak(at)blakjak(dot)sytes(dot)net>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Time span conversion function
Date: 2005-01-15 05:55:34
Message-ID: 41E8B056.8070002@blakjak.sytes.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kris Jurka wrote:

>On Sat, 15 Jan 2005, Brendan Jurd wrote:
>
>
>
>> > SELECT time_span( 'minute', now(), interval '10:43:55' );
>>643
>>
>>
>>
>
>The timestamp argument to this version of the function seems completely
>irrelevent.
>
>Kris Jurka
>
>
I don't think so. As I pointed out in the OP, to make this function
work properly you need to define a startpoint and an endpoint. The
version of the function which accepts (text, timestamp, interval)
arguments is really just using another notation to achieve the same
thing - startpoint and endpoint.

The timestamp argument is only irrelevant if you're willing to assume
now() is going to be the startpoint, which is not a fair assumption
IMO. I would rather give the caller the freedom of defining the
startpoint himself, in either notation.

Of course, it would be possible to create a shorthand version of the
function which expects (text, interval), and passes directly to
time_span($1, now(), $2).

Does that resolve your concern? If not please explain it more fully.

BJ

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-01-15 06:01:35 On schedule for 8.0.0 packaging on Monday
Previous Message Alvaro Herrera 2005-01-15 04:26:07 Re: sparse (static analyzer) report