Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Kris Jurka wrote:

>On Sat, 15 Jan 2005, Brendan Jurd wrote:
>> > SELECT time_span( 'minute', now(), interval '10:43:55' );
>The timestamp argument to this version of the function seems completely 
>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.


In response to


pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group