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

Re: Time span conversion function

From: Brendan Jurd <blakjak(at)blakjak(dot)sytes(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Time span conversion function
Date: 2005-01-15 06:25:41
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Tom Lane wrote:

>Brendan Jurd <blakjak(at)blakjak(dot)sytes(dot)net> writes:
>>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).
>This bothers me a bit.  That essentially says that (text, interval)
>has a hidden instability: the results depend on when you execute it.
>If we allow this form, it should be restricted to only those units
>(values of the text parameter) for which the result would *not*
>depend on now().
mm, I see your point.  I suppose the only real reason to have the 
shorthand version is for people who want to test an interval value and 
don't particularly care what the startpoint is -- so they just use now() 
because it's a convenient way of getting a timestamp that satisfies the 

To be honest, I'd be quite comfortable with dropping the shorthand 
version from the proposal.  If the caller has to type another 7 
characters, so be it.  It could fall under the "if you want it, define 
your own function for it" category.


In response to

pgsql-hackers by date

Next:From: Greg StarkDate: 2005-01-15 07:14:17
Subject: Re: sparse (static analyzer) report
Previous:From: Tom LaneDate: 2005-01-15 06:20:23
Subject: Re: Time span conversion function

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